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

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

commit c575ff06e92a3320dda9b06ea4d5738d7f871502
Author: xuxin19 <[email protected]>
AuthorDate: Wed Oct 15 11:16:54 2025 +0800

    cmake: make nuttx_link_libraries() options transitive
    
    nuttx_link_libraries() copied the INTERFACE compile options,
    definitions and include directories of each dependency into the
    target as PRIVATE, so libraries that depend on the target did not
    inherit them.
    
    Add them as PUBLIC so that they propagate, and skip the target itself
    to avoid a self-reference.
    
    Signed-off-by: xuxin19 <[email protected]>
---
 cmake/nuttx_extensions.cmake | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/cmake/nuttx_extensions.cmake b/cmake/nuttx_extensions.cmake
index a66e02d9636..1decac1c47d 100644
--- a/cmake/nuttx_extensions.cmake
+++ b/cmake/nuttx_extensions.cmake
@@ -439,18 +439,22 @@ function(nuttx_link_libraries)
   set(TARGET ${ARGV0})
   if(TARGET ${TARGET})
     foreach(dep ${ARGN})
-      target_compile_options(
-        ${TARGET}
-        PRIVATE
-          $<GENEX_EVAL:$<TARGET_PROPERTY:${dep},INTERFACE_COMPILE_OPTIONS>>)
-      target_compile_definitions(
-        ${TARGET}
-        PRIVATE
-          
$<GENEX_EVAL:$<TARGET_PROPERTY:${dep},INTERFACE_COMPILE_DEFINITIONS>>)
-      target_include_directories(
-        ${TARGET}
-        PRIVATE
-          
$<GENEX_EVAL:$<TARGET_PROPERTY:${dep},INTERFACE_INCLUDE_DIRECTORIES>>)
+      if(NOT "${dep}" STREQUAL "${TARGET}")
+        target_compile_options(
+          ${TARGET}
+          PUBLIC
+            $<GENEX_EVAL:$<TARGET_PROPERTY:${dep},INTERFACE_COMPILE_OPTIONS>>)
+        target_compile_definitions(
+          ${TARGET}
+          PUBLIC
+            
$<GENEX_EVAL:$<TARGET_PROPERTY:${dep},INTERFACE_COMPILE_DEFINITIONS>>
+        )
+        target_include_directories(
+          ${TARGET}
+          PUBLIC
+            
$<GENEX_EVAL:$<TARGET_PROPERTY:${dep},INTERFACE_INCLUDE_DIRECTORIES>>
+        )
+      endif()
     endforeach()
   endif()
 endfunction()

Reply via email to