[clang] [lld] Add the type to target_link_libraries (PR #133596)

via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 29 13:27:17 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lld

Author: Theo Paris (theoparis)

<details>
<summary>Changes</summary>

This fixes building with LLVM_TOOL_LLVM_DRIVER_BUILD and LLVM_LINK_LLVM_DYLIB set to true. CMake requires that "all uses of target_link_libraries with a target must be either all-keyword or all-plain".


---
Full diff: https://github.com/llvm/llvm-project/pull/133596.diff


2 Files Affected:

- (modified) clang/cmake/modules/AddClang.cmake (+1-1) 
- (modified) lld/tools/lld/CMakeLists.txt (+1-1) 


``````````diff
diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake
index cdc8bd5cd503b..45dd60206195d 100644
--- a/clang/cmake/modules/AddClang.cmake
+++ b/clang/cmake/modules/AddClang.cmake
@@ -213,7 +213,7 @@ endmacro()
 
 function(clang_target_link_libraries target type)
   if (TARGET obj.${target})
-    target_link_libraries(obj.${target} ${ARGN})
+    target_link_libraries(obj.${target} ${type} ${ARGN})
   endif()
 
   get_property(LLVM_DRIVER_TOOLS GLOBAL PROPERTY LLVM_DRIVER_TOOLS)
diff --git a/lld/tools/lld/CMakeLists.txt b/lld/tools/lld/CMakeLists.txt
index 8498a91597a93..1d1a7ff448b7c 100644
--- a/lld/tools/lld/CMakeLists.txt
+++ b/lld/tools/lld/CMakeLists.txt
@@ -13,7 +13,7 @@ export_executable_symbols_for_plugins(lld)
 
 function(lld_target_link_libraries target type)
   if (TARGET obj.${target})
-    target_link_libraries(obj.${target} ${ARGN})
+    target_link_libraries(obj.${target} ${type} ${ARGN})
   endif()
 
   get_property(LLVM_DRIVER_TOOLS GLOBAL PROPERTY LLVM_DRIVER_TOOLS)

``````````

</details>


https://github.com/llvm/llvm-project/pull/133596


More information about the llvm-commits mailing list