[clang-tools-extra] [clangd] Use clang_target_link_libraries() for clang libs (PR #94937)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 10 01:10:54 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-tools-extra

Author: Nikita Popov (nikic)

<details>
<summary>Changes</summary>

Use clang_target_link_libraries() instead of LINK_LIBS when linking clang libraries. This ensures that in CLANG_LINK_CLANG_DYLIB mode we link against libclang-cpp.so (instead of linking against both it and the static libraries).

Most places were already doing this correctly, there were just a handful of leftovers.

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


3 Files Affected:

- (modified) clang-tools-extra/clangd/index/remote/CMakeLists.txt (+5-1) 
- (modified) clang-tools-extra/pseudo/lib/CMakeLists.txt (+6-2) 
- (modified) clang-tools-extra/pseudo/lib/cxx/CMakeLists.txt (+5-1) 


``````````diff
diff --git a/clang-tools-extra/clangd/index/remote/CMakeLists.txt b/clang-tools-extra/clangd/index/remote/CMakeLists.txt
index ed6269d2ccaa9..106bbeff84ccf 100644
--- a/clang-tools-extra/clangd/index/remote/CMakeLists.txt
+++ b/clang-tools-extra/clangd/index/remote/CMakeLists.txt
@@ -26,7 +26,6 @@ if (CLANGD_ENABLE_REMOTE)
     clangdRemoteIndexProto
     clangdRemoteIndexServiceProto
     clangdRemoteMarshalling
-    clangBasic
     clangDaemon
     clangdSupport
 
@@ -35,6 +34,11 @@ if (CLANGD_ENABLE_REMOTE)
     clangdRemoteIndexServiceProto
     )
 
+  clang_target_link_libraries(clangdRemoteIndex
+    PRIVATE
+    clangBasic
+    )
+
   add_subdirectory(marshalling)
   add_subdirectory(server)
   add_subdirectory(monitor)
diff --git a/clang-tools-extra/pseudo/lib/CMakeLists.txt b/clang-tools-extra/pseudo/lib/CMakeLists.txt
index f92f79be12150..a13b5d20cf7c3 100644
--- a/clang-tools-extra/pseudo/lib/CMakeLists.txt
+++ b/clang-tools-extra/pseudo/lib/CMakeLists.txt
@@ -14,8 +14,6 @@ add_clang_library(clangPseudo
   Token.cpp
 
   LINK_LIBS
-  clangBasic
-  clangLex
   clangPseudoGrammar
 
   DEPENDS
@@ -25,3 +23,9 @@ add_clang_library(clangPseudo
   target_include_directories(clangPseudo INTERFACE
   $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
   )
+
+clang_target_link_libraries(clangPseudo
+  PRIVATE
+  clangBasic
+  clangLex
+  )
diff --git a/clang-tools-extra/pseudo/lib/cxx/CMakeLists.txt b/clang-tools-extra/pseudo/lib/cxx/CMakeLists.txt
index d56d16c893c3d..2fecdce6a10f9 100644
--- a/clang-tools-extra/pseudo/lib/cxx/CMakeLists.txt
+++ b/clang-tools-extra/pseudo/lib/cxx/CMakeLists.txt
@@ -9,7 +9,11 @@ add_clang_library(clangPseudoCXX
   cxx_gen
 
   LINK_LIBS
-  clangBasic
   clangPseudo
   clangPseudoGrammar
   )
+
+clang_target_link_libraries(clangPseudoCXX
+  PRIVATE
+  clangBasic
+  )

``````````

</details>


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


More information about the cfe-commits mailing list