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

via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 10 23:08:06 PDT 2024


Author: Nikita Popov
Date: 2024-06-11T08:08:03+02:00
New Revision: 34033dc1610982570328b39a38596a9968e3c7b2

URL: https://github.com/llvm/llvm-project/commit/34033dc1610982570328b39a38596a9968e3c7b2
DIFF: https://github.com/llvm/llvm-project/commit/34033dc1610982570328b39a38596a9968e3c7b2.diff

LOG: [clangd] Use clang_target_link_libraries() for clang libs (#94937)

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.

Added: 
    

Modified: 
    clang-tools-extra/clangd/index/remote/CMakeLists.txt
    clang-tools-extra/pseudo/lib/CMakeLists.txt
    clang-tools-extra/pseudo/lib/cxx/CMakeLists.txt

Removed: 
    


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


        


More information about the cfe-commits mailing list