This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 738f683b7d0 cmake: add -D__NuttX__ to preprocessor
738f683b7d0 is described below

commit 738f683b7d09669d7e4354abdc0ba7750839e60b
Author: Filipe Cavalcanti <[email protected]>
AuthorDate: Wed Apr 8 21:35:20 2026 -0300

    cmake: add -D__NuttX__ to preprocessor
    
    This change allows for linker script files to be properly processed when
    `#ifdef __NuttX__` is used.
    
    Signed-off-by: Filipe Cavalcanti <[email protected]>
---
 cmake/nuttx_toolchain.cmake | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/cmake/nuttx_toolchain.cmake b/cmake/nuttx_toolchain.cmake
index 3156d880414..d52cdb62904 100644
--- a/cmake/nuttx_toolchain.cmake
+++ b/cmake/nuttx_toolchain.cmake
@@ -74,6 +74,7 @@ endif()
 if(NOT NUTTX_TOOLCHAIN_PREPROCESS_DEFINED)
   function(nuttx_generate_preprocess_target)
 
+    set(DEFINES -D__NuttX__)
     # parse arguments into variables
 
     nuttx_parse_function_args(
@@ -92,8 +93,10 @@ if(NOT NUTTX_TOOLCHAIN_PREPROCESS_DEFINED)
 
     add_custom_command(
       OUTPUT ${TARGET_FILE}
-      COMMAND ${PREPROCESS} -I${CMAKE_BINARY_DIR}/include 
-I${NUTTX_DIR}/include
-              -I${NUTTX_CHIP_ABS_DIR} ${SOURCE_FILE} > ${TARGET_FILE}
+      COMMAND
+        ${PREPROCESS} ${DEFINES} -I${CMAKE_BINARY_DIR}/include
+        -I${NUTTX_DIR}/include -I${NUTTX_CHIP_ABS_DIR} ${SOURCE_FILE} >
+        ${TARGET_FILE}
       DEPENDS ${SOURCE_FILE} ${DEPENDS})
 
   endfunction()

Reply via email to