Skip to content

Add the type to target_link_libraries #133596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

theoparis
Copy link

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".

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".
Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added clang Clang issues not falling into any other category lld labels Mar 29, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 29, 2025

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-lld

Author: Theo Paris (theoparis)

Changes

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 --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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category lld
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants