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

xiaoxiang 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 b12bf1ef33 arm/cmake: fix cmake compile error
b12bf1ef33 is described below

commit b12bf1ef3345dd85634a54f073a5448c4c7430d6
Author: wangmingrong1 <[email protected]>
AuthorDate: Sat Oct 12 17:10:26 2024 +0800

    arm/cmake: fix cmake compile error
    
    1. The -c parameter should not be added during the link phase, otherwise 
the link will fail.
    2. If it is the clang compiler, its toolchain library should use 
--print-file-name to find it, otherwise an error will occur
    
    Signed-off-by: wangmingrong1 <[email protected]>
---
 arch/arm/src/cmake/clang.cmake | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/arch/arm/src/cmake/clang.cmake b/arch/arm/src/cmake/clang.cmake
index 55ef881b68..b0e7f1221f 100644
--- a/arch/arm/src/cmake/clang.cmake
+++ b/arch/arm/src/cmake/clang.cmake
@@ -231,6 +231,17 @@ if(NOT CONFIG_CXX_RTTI)
   add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>)
 endif()
 
-set(CMAKE_EXE_LINKER_FLAGS_INIT "-c")
-
 set(PREPROCESS ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} -E -P -x c)
+
+# override nuttx_find_toolchain_lib
+
+set(NUTTX_FIND_TOOLCHAIN_LIB_DEFINED true)
+
+function(nuttx_find_toolchain_lib)
+  execute_process(
+    COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS}
+            --print-file-name
+    OUTPUT_STRIP_TRAILING_WHITESPACE
+    OUTPUT_VARIABLE extra_lib_path)
+  nuttx_add_extra_library(${extra_lib_path})
+endfunction()

Reply via email to