cmake(bugfix):fix KERNEL mod elf target dup with lib target

Using the same name as elf may lead to duplicate errors.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
This commit is contained in:
xuxin19
2025-03-06 16:06:55 +08:00
committed by GUIDINGLI
parent 197149a297
commit 885ff780c5

View File

@@ -116,6 +116,8 @@ function(nuttx_add_application)
# Use ELF capable toolchain, by building manually and overwriting the
# non-elf output
if(NOT CMAKE_C_ELF_COMPILER)
set(ELF_NAME "${NAME}")
set(TARGET "ELF_${TARGET}")
add_library(${TARGET} ${SRCS})
add_dependencies(${TARGET} apps_post)
add_custom_command(
@@ -128,7 +130,7 @@ function(nuttx_add_application)
$<TARGET_OBJECTS:STARTUP_OBJS> --start-group
$<GENEX_EVAL:$<TARGET_PROPERTY:nuttx_global,NUTTX_ELF_LINK_LIBRARIES>>
$<TARGET_FILE:${TARGET}> --end-group -o
${CMAKE_BINARY_DIR}/bin/${TARGET}
${CMAKE_BINARY_DIR}/bin/${ELF_NAME}
COMMAND_EXPAND_LISTS)
else()
add_executable(${TARGET} ${SRCS})