cmake px4_add_module() make properties private

This commit is contained in:
Daniel Agar 2017-11-21 01:56:27 -05:00 committed by ChristophTobler
parent fc80846825
commit 822fc5725c
1 changed files with 10 additions and 13 deletions

View File

@ -205,12 +205,6 @@ function(px4_add_module)
set(STACK_MAIN_DEFAULT 1024)
set(PRIORITY_DEFAULT SCHED_PRIORITY_DEFAULT)
# default stack max to stack main
if(NOT STACK_MAIN AND STACK)
set(STACK_MAIN ${STACK})
message(AUTHOR_WARNING "STACK deprecated, USE STACK_MAIN instead!")
endif()
foreach(property MAIN STACK_MAIN PRIORITY)
if(NOT ${property})
set(${property} ${${property}_DEFAULT})
@ -227,15 +221,18 @@ function(px4_add_module)
if(${OS} STREQUAL "qurt" )
set_property(TARGET ${MODULE} PROPERTY POSITION_INDEPENDENT_CODE TRUE)
elseif(${OS} STREQUAL "nuttx" )
list(APPEND COMPILE_FLAGS -Wframe-larger-than=${STACK_MAX})
target_compile_options(${MODULE} PRIVATE -Wframe-larger-than=${STACK_MAX})
endif()
if(MAIN)
set_target_properties(${MODULE} PROPERTIES
COMPILE_DEFINITIONS PX4_MAIN=${MAIN}_app_main)
add_definitions(-DMODULE_NAME="${MAIN}")
target_compile_definitions(${MODULE} PRIVATE PX4_MAIN=${MAIN}_app_main)
target_compile_definitions(${MODULE} PRIVATE MODULE_NAME="${MAIN}")
else()
add_definitions(-DMODULE_NAME="${MODULE}")
target_compile_definitions(${MODULE} PRIVATE MODULE_NAME="${MODULE}")
endif()
if(COMPILE_FLAGS)
target_compile_options(${MODULE} PRIVATE ${COMPILE_FLAGS})
endif()
if(INCLUDES)
@ -247,7 +244,7 @@ function(px4_add_module)
endif()
# join list variables to get ready to send to compiler
foreach(prop LINK_FLAGS COMPILE_FLAGS)
foreach(prop LINK_FLAGS)
if(${prop})
px4_join(OUT ${prop} LIST ${${prop}} GLUE " ")
endif()
@ -259,7 +256,7 @@ function(px4_add_module)
if(COMPILE_FLAGS AND ${_no_optimization_for_target})
px4_strip_optimization(COMPILE_FLAGS ${COMPILE_FLAGS})
endif()
foreach (prop COMPILE_FLAGS LINK_FLAGS STACK_MAIN MAIN PRIORITY)
foreach (prop LINK_FLAGS STACK_MAIN MAIN PRIORITY)
if (${prop})
set_target_properties(${MODULE} PROPERTIES ${prop} ${${prop}})
endif()