diff --git a/cmake/nuttx_add_application.cmake b/cmake/nuttx_add_application.cmake index ab8d4b2586b..2dee999c248 100644 --- a/cmake/nuttx_add_application.cmake +++ b/cmake/nuttx_add_application.cmake @@ -117,7 +117,7 @@ function(nuttx_add_application) # non-elf output if(NOT CMAKE_C_ELF_COMPILER) add_library(${TARGET} ${SRCS}) - add_dependencies(${TARGET} nuttx_post) + add_dependencies(${TARGET} apps_post) add_custom_command( TARGET ${TARGET} POST_BUILD diff --git a/cmake/nuttx_add_library.cmake b/cmake/nuttx_add_library.cmake index d6ba8c0864c..31a55455be7 100644 --- a/cmake/nuttx_add_library.cmake +++ b/cmake/nuttx_add_library.cmake @@ -81,7 +81,9 @@ endfunction() function(nuttx_add_aux_library target) # declare target add_library(${target} OBJECT ${ARGN}) - + # make sure context and post time ordering + add_dependencies(${target} apps_context) + add_dependencies(apps_post ${target}) nuttx_add_library_internal(${target} ${ARGN}) endfunction() @@ -93,7 +95,10 @@ endfunction() function(nuttx_add_user_library target) # declare target add_library(${target} OBJECT ${ARGN}) + # make sure context and post time ordering add_dependencies(${target} apps_context) + add_dependencies(apps_post ${target}) + nuttx_add_library_internal(${target} ${ARGN}) # link to final libapps @@ -112,6 +117,9 @@ endfunction() function(nuttx_add_system_library target) # declare target add_library(${target} ${ARGN}) + # make sure context and post time ordering + add_dependencies(${target} apps_context) + add_dependencies(apps_post ${target}) # add library to build nuttx_add_library_internal(${target} ${ARGN}) @@ -124,7 +132,6 @@ function(nuttx_add_system_library target) APPEND PROPERTY NUTTX_ELF_LINK_LIBRARIES $) - add_dependencies(nuttx_post ${target}) endfunction() # Kernel Libraries @@ -201,7 +208,9 @@ define_property( # function(nuttx_add_library target) add_library(${target} ${ARGN}) + # make sure context and post time ordering add_dependencies(${target} apps_context) + add_dependencies(apps_post ${target}) set_property(GLOBAL APPEND PROPERTY NUTTX_SYSTEM_LIBRARIES ${target}) set_property( @@ -209,8 +218,6 @@ function(nuttx_add_library target) APPEND PROPERTY NUTTX_ELF_LINK_LIBRARIES $) - add_dependencies(nuttx_post ${target}) - # Set apps global compile options & definitions hold by nuttx_apps_interface target_compile_options( ${target} @@ -279,12 +286,15 @@ endfunction() function(nuttx_add_external_library target) cmake_parse_arguments(ARGS "" MODE "" ${ARGN}) if(NOT ARGS_MODE) + # if we add external library as system lib, make sure context and post time + # ordering + add_dependencies(${target} apps_context) + add_dependencies(apps_post ${target}) set_property(GLOBAL APPEND PROPERTY NUTTX_SYSTEM_LIBRARIES ${target}) set_property( TARGET nuttx_global APPEND PROPERTY NUTTX_ELF_LINK_LIBRARIES $) - add_dependencies(nuttx_post ${target}) elseif("${ARGS_MODE}" STREQUAL "APPS") set_property(GLOBAL APPEND PROPERTY NUTTX_APPS_LIBRARIES ${target}) elseif("${ARGS_MODE}" STREQUAL "KERNEL") diff --git a/cmake/nuttx_generate_headers.cmake b/cmake/nuttx_generate_headers.cmake index 8cb290f9d18..1e12a42b7d8 100644 --- a/cmake/nuttx_generate_headers.cmake +++ b/cmake/nuttx_generate_headers.cmake @@ -156,3 +156,7 @@ add_custom_target( # apps_context is a PHONY target used as an intermediate process to control the # time order of context preparation actions of app building add_custom_target(apps_context ALL DEPENDS nuttx_context) + +# apps_post is a PHONY target used as an intermediate process to control the +# time order of all apps library has been built +add_custom_target(apps_post)