cmake(enhance):add target we can dump all CMake lib targets

`cmake --build -t dump_targets`
list all lib target current generator need to build

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
This commit is contained in:
xuxin19
2024-12-05 20:30:18 +08:00
committed by Xiang Xiao
parent bca7d17a1d
commit f6db05a94f
2 changed files with 21 additions and 0 deletions

View File

@@ -62,6 +62,12 @@ function(nuttx_add_library_internal target)
# Set install config for all library
install(TARGETS ${target})
# Set target information for debug and dump
set_property(
TARGET nuttx_target_interface
APPEND
PROPERTY ALL_TARGETS ${target})
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/targets "${target}\n")
endfunction()
# Auxiliary libraries

View File

@@ -28,6 +28,10 @@ include(nuttx_parse_function_args)
# compiler options and include path needed by all apps libraries.
add_custom_target(nuttx_apps_interface)
# "nuttx_target_interface" is a source-less target that hold target information
# for target debug and dump
add_custom_target(nuttx_target_interface)
# Macro: nuttx_library
#
# Creates a library target with the given name and mode. If MODE is "KERNEL", it
@@ -298,3 +302,14 @@ function(nuttx_link_libraries)
endforeach()
endif()
endfunction()
# dump targets information
add_custom_target(
dump_targets
COMMAND ${CMAKE_COMMAND} -E remove target_dump
COMMAND ${CMAKE_COMMAND} -E echo
"'$<TARGET_PROPERTY:nuttx_target_interface,ALL_TARGETS>'"
COMMAND
${CMAKE_COMMAND} -E echo
"'$<TARGET_PROPERTY:nuttx_target_interface,ALL_TARGETS>'" >> target_dump
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})