aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/CMakeLists.txt
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-12-20 10:59:25 -0800
committerJosh Blum <josh@joshknows.com>2010-12-20 10:59:25 -0800
commit42ed1d34245bf14f71e4777bc8efc1d4ff4db26f (patch)
tree91be1aec11ac39c42dcb14a37c2fd6799de4d012 /host/lib/CMakeLists.txt
parent47c92a2ac68fbae59c02f3e2a322cabda499c13b (diff)
downloaduhd-42ed1d34245bf14f71e4777bc8efc1d4ff4db26f.tar.gz
uhd-42ed1d34245bf14f71e4777bc8efc1d4ff4db26f.tar.bz2
uhd-42ed1d34245bf14f71e4777bc8efc1d4ff4db26f.zip
uhd: use the include subdir macro to simplify the lib subdirs cmakelists
Diffstat (limited to 'host/lib/CMakeLists.txt')
-rw-r--r--host/lib/CMakeLists.txt32
1 files changed, 27 insertions, 5 deletions
diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt
index e4de7bcc7..28e4bcca2 100644
--- a/host/lib/CMakeLists.txt
+++ b/host/lib/CMakeLists.txt
@@ -61,13 +61,35 @@ MACRO(LIBUHD_PYTHON_GEN_SOURCE pyfile outfile)
LIBUHD_APPEND_SOURCES(${outfile})
ENDMACRO(LIBUHD_PYTHON_GEN_SOURCE)
+MACRO(INCLUDE_SUBDIRECTORY subdir)
+ #insert the current directories on the front of the list
+ LIST(INSERT _cmake_source_dirs 0 ${CMAKE_CURRENT_SOURCE_DIR})
+ LIST(INSERT _cmake_binary_dirs 0 ${CMAKE_CURRENT_BINARY_DIR})
+
+ #set the current directories to the names of the subdirs
+ SET(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${subdir})
+ SET(CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${subdir})
+
+ #include the subdirectory CMakeLists to run it
+ FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+ INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt)
+
+ #reset the value of the current directories
+ LIST(GET _cmake_source_dirs 0 CMAKE_CURRENT_SOURCE_DIR)
+ LIST(GET _cmake_binary_dirs 0 CMAKE_CURRENT_BINARY_DIR)
+
+ #pop the subdir names of the front of the list
+ LIST(REMOVE_AT _cmake_source_dirs 0)
+ LIST(REMOVE_AT _cmake_binary_dirs 0)
+ENDMACRO(INCLUDE_SUBDIRECTORY)
+
########################################################################
-# Include CMakeLists.txt from subdirectories
+# Include subdirectories (different than add)
########################################################################
-INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/ic_reg_maps/CMakeLists.txt)
-INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/transport/CMakeLists.txt)
-INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/usrp/CMakeLists.txt)
-INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/utils/CMakeLists.txt)
+INCLUDE_SUBDIRECTORY(ic_reg_maps)
+INCLUDE_SUBDIRECTORY(transport)
+INCLUDE_SUBDIRECTORY(usrp)
+INCLUDE_SUBDIRECTORY(utils)
########################################################################
# Append to the list of sources for lib uhd