cmake:add unified timing control phase apps_context for apps build

solve the interdependency problem of cross-target dependency generation.
like Makefile base, a PHONY context target is used as a dependency for timing order.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
This commit is contained in:
xuxin19 2024-06-04 15:13:14 +08:00 committed by Xiang Xiao
parent 4cb419866f
commit b1b66ce491
3 changed files with 10 additions and 2 deletions

View File

@ -167,6 +167,10 @@ function(nuttx_add_application)
set_property(GLOBAL APPEND PROPERTY NUTTX_APPS_ONLY_REGISTER ${TARGET})
endif()
# apps applications need to depends on apps_context by default
add_dependencies(${TARGET} apps_context)
# store parameters into properties (used during builtin list generation)
set_target_properties(${TARGET} PROPERTIES APP_MAIN ${NAME}_main)

View File

@ -79,7 +79,7 @@ endfunction()
function(nuttx_add_user_library target)
# declare target
add_library(${target} OBJECT ${ARGN})
add_dependencies(${target} apps_context)
nuttx_add_library_internal(${target} ${ARGN})
# link to final libapps
@ -180,7 +180,7 @@ define_property(
#
function(nuttx_add_library target)
add_library(${target} ${ARGN})
add_dependencies(${target} apps_context)
set_property(GLOBAL APPEND PROPERTY NUTTX_SYSTEM_LIBRARIES ${target})
nuttx_add_library_internal(${target})

View File

@ -152,3 +152,7 @@ add_custom_target(
$<$<BOOL:${NEED_MATH_H}>:${CMAKE_BINARY_DIR}/include/math.h>
$<$<BOOL:${CONFIG_ARCH_FLOAT_H}>:${CMAKE_BINARY_DIR}/include/float.h>
$<$<BOOL:${CONFIG_ARCH_SETJMP_H}>:${CMAKE_BINARY_DIR}/include/setjmp.h>)
# 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)