Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

fsfod
Copy link
Contributor

@fsfod fsfod commented Sep 19, 2024

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.

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
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Sep 19, 2024
@llvmbot
Copy link
Member

llvmbot commented Sep 19, 2024

@llvm/pr-subscribers-clang

Author: Thomas Fransham (fsfod)

Changes

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

Copy link
Contributor

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks reasonable to me.

@vgvassilev vgvassilev merged commit dab3c6d into llvm:main Sep 20, 2024
10 checks passed
@fsfod fsfod deleted the exported-api/clang-attribute-plugin branch October 14, 2024 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants