cmake: add support for out-of-tree modules via EXTERNAL_MODULES_LOCATION variable

This commit is contained in:
Beat Küng
2016-09-07 14:05:22 +02:00
committed by Lorenz Meier
parent 65e3ae70dd
commit 670c93e726
3 changed files with 33 additions and 1 deletions

View File

@@ -146,6 +146,7 @@ set_property(CACHE CONFIG PROPERTY STRINGS ${configs})
set(THREADS "4" CACHE STRING
"number of threads to use for external build processes")
set(DEBUG_PORT "/dev/ttyACM0" CACHE STRING "debugging port")
set(EXTERNAL_MODULES_LOCATION "" CACHE STRING "External modules source location")
#=============================================================================
# configuration
@@ -371,6 +372,24 @@ foreach(driver ${config_df_driver_list})
message("Adding DF driver: ${driver}")
endforeach()
#=============================================================================
# external modules
#
if(NOT EXTERNAL_MODULES_LOCATION STREQUAL "")
message(STATUS "External modules: ${EXTERNAL_MODULES_LOCATION}")
add_subdirectory("${EXTERNAL_MODULES_LOCATION}/src" external_modules_src)
set(config_module_list_external_expanded)
foreach(external_module ${config_module_list_external})
list(APPEND config_module_list_external_expanded
${EXTERNAL_MODULES_LOCATION}/src/${external_module})
endforeach()
set(config_module_list
${config_module_list}
${config_module_list_external_expanded}
)
endif()
#=============================================================================
# subdirectories
#