From d676716e7a7dc348e8cf3188200187dc9d49dde4 Mon Sep 17 00:00:00 2001 From: xuxin19 Date: Thu, 20 Mar 2025 15:39:14 +0800 Subject: [PATCH] cmake(feat):separate ELF output bin and bin_debug bin for striped elf Signed-off-by: xuxin19 --- cmake/nuttx_add_application.cmake | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cmake/nuttx_add_application.cmake b/cmake/nuttx_add_application.cmake index 4dd70a872bc..5a125590e51 100644 --- a/cmake/nuttx_add_application.cmake +++ b/cmake/nuttx_add_application.cmake @@ -28,11 +28,16 @@ define_property( BRIEF_DOCS "NuttX application libs" FULL_DOCS "List of all NuttX application libraries") -# Create a directory for the application binaries +# Create a directories for the application binaries `bin` for stripped binaries +# `bin_debug` for debug binaries if(NOT EXISTS ${CMAKE_BINARY_DIR}/bin) file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin) endif() +if(NOT EXISTS ${CMAKE_BINARY_DIR}/bin_debug) + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin_debug) +endif() + # ~~~ # nuttx_add_application # @@ -131,7 +136,11 @@ function(nuttx_add_application) $<$:$>> $> $ --end-group -o + ${CMAKE_BINARY_DIR}/bin_debug/${ELF_NAME} + COMMAND + ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bin_debug/${ELF_NAME} ${CMAKE_BINARY_DIR}/bin/${ELF_NAME} + COMMAND ${CMAKE_STRIP} ${CMAKE_BINARY_DIR}/bin/${ELF_NAME} COMMENT "Building ELF:${ELF_NAME}" COMMAND_EXPAND_LISTS) else()