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
+7
View File
@@ -231,6 +231,7 @@ endfunction()
# [ COMPILE_FLAGS <list> ]
# [ INCLUDES <list> ]
# [ DEPENDS <string> ]
# [ EXTERNAL ]
# )
#
# Input:
@@ -244,6 +245,7 @@ endfunction()
# SRCS : source files
# INCLUDES : include directories
# DEPENDS : targets which this module depends on
# EXTERNAL : flag to indicate that this module is out-of-tree
#
# Output:
# Static library with name matching MODULE.
@@ -263,9 +265,14 @@ function(px4_add_module)
NAME px4_add_module
ONE_VALUE MODULE MAIN STACK STACK_MAIN STACK_MAX PRIORITY
MULTI_VALUE COMPILE_FLAGS LINK_FLAGS SRCS INCLUDES DEPENDS
OPTIONS EXTERNAL
REQUIRED MODULE
ARGN ${ARGN})
if(EXTERNAL)
px4_mangle_name("${EXTERNAL_MODULES_LOCATION}/src/${MODULE}" MODULE)
endif()
px4_add_library(${MODULE} STATIC EXCLUDE_FROM_ALL ${SRCS})
# set defaults if not set