[clang] [Clang] Change Attribute plugin to link clang-cpp like other examples (PR #109319)

via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 19 11:50:47 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Thomas Fransham (fsfod)

<details>
<summary>Changes</summary>

Change the Attribute example plugin to use clang_target_link_libraries instead of target_link_libraries so libclang-cpp is linked when the CLANG_LINK_CLANG_DYLIB CMake option is used. 
This change will allow building the plugin on windows when building llvm and clang as a shared library with explicit visibility macros enabled.

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


1 Files Affected:

- (modified) clang/examples/Attribute/CMakeLists.txt (+4-2) 


``````````diff
diff --git a/clang/examples/Attribute/CMakeLists.txt b/clang/examples/Attribute/CMakeLists.txt
index 770fa28364b770..0200063d86b0ca 100644
--- a/clang/examples/Attribute/CMakeLists.txt
+++ b/clang/examples/Attribute/CMakeLists.txt
@@ -1,11 +1,13 @@
 add_llvm_library(Attribute MODULE Attribute.cpp PLUGIN_TOOL clang)
 
 if(WIN32 OR CYGWIN)
-  target_link_libraries(Attribute PRIVATE
+  set(LLVM_LINK_COMPONENTS
+    Support
+  )
+  clang_target_link_libraries(Attribute PRIVATE
     clangAST
     clangBasic
     clangFrontend
     clangLex
-    LLVMSupport
     )
 endif()

``````````

</details>


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


More information about the cfe-commits mailing list