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

xiaoxiang781216 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 f5df0fcb186 cmake: parse EXTRAFLAGS with separate_arguments.
f5df0fcb186 is described below

commit f5df0fcb1867be1ce87e79fb328110facb1c1340
Author: Zhaoqi Xu <[email protected]>
AuthorDate: Mon Aug 31 16:23:10 2026 +0800

    cmake: parse EXTRAFLAGS with separate_arguments.
    
    string(REPLACE) splits on every space, so a flag such as
    -I"/path with spaces" becomes several bogus compile options.
    Use separate_arguments(UNIX_COMMAND), matching EXTRA_FLAGS.
    
    Signed-off-by: Zhaoqi Xu <[email protected]>
---
 cmake/nuttx_add_library.cmake | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cmake/nuttx_add_library.cmake b/cmake/nuttx_add_library.cmake
index d773375fb7d..dc10bfb5815 100644
--- a/cmake/nuttx_add_library.cmake
+++ b/cmake/nuttx_add_library.cmake
@@ -55,8 +55,8 @@ function(nuttx_add_library_internal target)
   # add extra flags into command line
 
   if(DEFINED EXTRAFLAGS)
-    string(REPLACE " " ";" eflags "${EXTRAFLAGS}")
-    target_compile_options(${target} PRIVATE ${eflags})
+    separate_arguments(EXTRAFLAGS_LIST UNIX_COMMAND "${EXTRAFLAGS}")
+    target_compile_options(${target} PRIVATE ${EXTRAFLAGS_LIST})
   endif()
 
   # Set install config for all library

Reply via email to