llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clangd

Author: Fabrice de Gans (Steelskin)

<details>
<summary>Changes</summary>

The proper way to reference LLVM components is to pass them via the 
LLVM_LINK_COMPONENTS variable. This is needed when building LLVM as a dylib, so 
the proper dependency (the LLVM library) is passed.

This does not apply to plain add_executable() targets, which should manually 
select to link against LLVM or individual LLVM components.

The effort to build LLVM as a dylib is tracked in #<!-- -->109483.

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


4 Files Affected:

- (modified) clang-tools-extra/clangd/benchmarks/CMakeLists.txt (+4-1) 
- (modified) clang-tools-extra/clangd/benchmarks/CompletionModel/CMakeLists.txt 
(+4-1) 
- (modified) cross-project-tests/CMakeLists.txt (+4-1) 
- (modified) 
cross-project-tests/debuginfo-tests/llvm-prettyprinters/lldb/CMakeLists.txt 
(+7-1) 


``````````diff
diff --git a/clang-tools-extra/clangd/benchmarks/CMakeLists.txt 
b/clang-tools-extra/clangd/benchmarks/CMakeLists.txt
index 13ca21ad70d81..13beec4919ebf 100644
--- a/clang-tools-extra/clangd/benchmarks/CMakeLists.txt
+++ b/clang-tools-extra/clangd/benchmarks/CMakeLists.txt
@@ -2,10 +2,13 @@ if(CLANGD_DECISION_FOREST)
   add_subdirectory(CompletionModel)
 endif()
 
+set(LLVM_LINK_COMPONENTS
+  Support
+  )
+
 add_benchmark(IndexBenchmark IndexBenchmark.cpp)
 
 target_link_libraries(IndexBenchmark
   PRIVATE
   clangDaemon
-  LLVMSupport
   )
diff --git a/clang-tools-extra/clangd/benchmarks/CompletionModel/CMakeLists.txt 
b/clang-tools-extra/clangd/benchmarks/CompletionModel/CMakeLists.txt
index 4c7cd779eb3e7..81cf3cc0fca60 100644
--- a/clang-tools-extra/clangd/benchmarks/CompletionModel/CMakeLists.txt
+++ b/clang-tools-extra/clangd/benchmarks/CompletionModel/CMakeLists.txt
@@ -1,7 +1,10 @@
+set(LLVM_LINK_COMPONENTS
+  Support
+  )
+
 add_benchmark(DecisionForestBenchmark DecisionForestBenchmark.cpp)
 
 target_link_libraries(DecisionForestBenchmark
   PRIVATE
   clangDaemon
-  LLVMSupport
   )
diff --git a/cross-project-tests/CMakeLists.txt 
b/cross-project-tests/CMakeLists.txt
index 85102065e79e6..8961958f6f16e 100644
--- a/cross-project-tests/CMakeLists.txt
+++ b/cross-project-tests/CMakeLists.txt
@@ -7,10 +7,13 @@ set(LLVM_SUBPROJECT_TITLE "Cross-Project")
 
 find_package(Python3 COMPONENTS Interpreter)
 
+set(LLVM_LINK_COMPONENTS
+  Support
+  )
+
 add_llvm_executable(check-gdb-llvm-support
         debuginfo-tests/llvm-prettyprinters/gdb/llvm-support.cpp
 )
-target_link_libraries(check-gdb-llvm-support PRIVATE LLVMSupport)
 
 add_subdirectory(debuginfo-tests/llvm-prettyprinters/lldb)
 
diff --git 
a/cross-project-tests/debuginfo-tests/llvm-prettyprinters/lldb/CMakeLists.txt 
b/cross-project-tests/debuginfo-tests/llvm-prettyprinters/lldb/CMakeLists.txt
index e2a9a080fd4c7..ac3efaf641c24 100644
--- 
a/cross-project-tests/debuginfo-tests/llvm-prettyprinters/lldb/CMakeLists.txt
+++ 
b/cross-project-tests/debuginfo-tests/llvm-prettyprinters/lldb/CMakeLists.txt
@@ -1,6 +1,12 @@
 add_library(lldb-formatter-test-settings INTERFACE)
 
-target_link_libraries(lldb-formatter-test-settings INTERFACE LLVMSupport)
+# Link the correct LLVM dependency, depending on the configuration.
+if(LLVM_LINK_LLVM_DYLIB)
+  target_link_libraries(lldb-formatter-test-settings INTERFACE LLVM)
+else()
+  target_link_libraries(lldb-formatter-test-settings INTERFACE LLVMSupport)
+endif()
+
 # Unset _FORTIFY_SOURCE since it's incompatible with -O0.
 target_compile_options(lldb-formatter-test-settings INTERFACE -g -O0 
-U_FORTIFY_SOURCE)
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/224624
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to