diff options
Diffstat (limited to 'host/lib/CMakeLists.txt')
-rw-r--r-- | host/lib/CMakeLists.txt | 32 |
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 |