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

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


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

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.

>From 287ce6d6f54283622c9c388d889dde7a455e65c5 Mon Sep 17 00:00:00 2001
From: Thomas Fransham <tfransham at gmail.com>
Date: Thu, 19 Sep 2024 19:41:44 +0100
Subject: [PATCH] [Clang] Change Attribute plugin to link clang-cpp like other
 examples

Switched clang_target_link_libraries instead of target_link_libraries so
libclang-cpp is linked when the CLANG_LINK_CLANG_DYLIB CMake option is used
---
 clang/examples/Attribute/CMakeLists.txt | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

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



More information about the cfe-commits mailing list