[clang] 609ef94 - [CMake] Fix building with -DBUILD_SHARED_LIBS=ON on mingw

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Mon May 11 13:51:29 PDT 2020


Author: Martin Storsjö
Date: 2020-05-11T23:51:14+03:00
New Revision: 609ef948387ba40e3693c2bd693d82ca34dcdc02

URL: https://github.com/llvm/llvm-project/commit/609ef948387ba40e3693c2bd693d82ca34dcdc02
DIFF: https://github.com/llvm/llvm-project/commit/609ef948387ba40e3693c2bd693d82ca34dcdc02.diff

LOG: [CMake] Fix building with -DBUILD_SHARED_LIBS=ON on mingw

Set the right target name in clang/examples/Attribute.

Add a missing dependency in the TableGen GlobalISel sublibrary.

Skip building the Bye pass plugin example on windows; plugins
that should have undefined symbols that are found in the host
process aren't supported on windows - this matches what was done
for a unit test in bc8e44218810c0db6328b9809c959ceb7d43e3f5.

Added: 
    

Modified: 
    clang/examples/Attribute/CMakeLists.txt
    llvm/examples/Bye/CMakeLists.txt
    llvm/utils/TableGen/GlobalISel/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/clang/examples/Attribute/CMakeLists.txt b/clang/examples/Attribute/CMakeLists.txt
index 19323bb0962b..ed02f5e5992f 100644
--- a/clang/examples/Attribute/CMakeLists.txt
+++ b/clang/examples/Attribute/CMakeLists.txt
@@ -1,7 +1,7 @@
 add_llvm_library(Attribute MODULE Attribute.cpp PLUGIN_TOOL clang)
 
 if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
-  target_link_libraries(AnnotateFunctions ${cmake_2_8_12_PRIVATE}
+  target_link_libraries(Attribute ${cmake_2_8_12_PRIVATE}
     clangAST
     clangBasic
     clangFrontend

diff  --git a/llvm/examples/Bye/CMakeLists.txt b/llvm/examples/Bye/CMakeLists.txt
index 3206f90d0916..362086eb1b32 100644
--- a/llvm/examples/Bye/CMakeLists.txt
+++ b/llvm/examples/Bye/CMakeLists.txt
@@ -2,12 +2,18 @@ if(LLVM_BYE_LINK_INTO_TOOLS)
   message(WARNING "Setting LLVM_BYE_LINK_INTO_TOOLS=ON only makes sense for testing purpose")
 endif()
 
-add_llvm_pass_plugin(Bye
-  Bye.cpp
-  DEPENDS
-  intrinsics_gen
-  BUILDTREE_ONLY
- )
+# The plugin expects to not link against the Support and Core libraries,
+# but expects them to exist in the process loading the plugin. This doesn't
+# work with DLLs on Windows (where a shared library can't have undefined
+# references), so just skip this testcase on Windows.
+if (NOT WIN32)
+  add_llvm_pass_plugin(Bye
+    Bye.cpp
+    DEPENDS
+    intrinsics_gen
+    BUILDTREE_ONLY
+   )
 
-install(TARGETS ${name} RUNTIME DESTINATION examples)
-set_target_properties(${name} PROPERTIES FOLDER "Examples")
+  install(TARGETS ${name} RUNTIME DESTINATION examples)
+  set_target_properties(${name} PROPERTIES FOLDER "Examples")
+endif()

diff  --git a/llvm/utils/TableGen/GlobalISel/CMakeLists.txt b/llvm/utils/TableGen/GlobalISel/CMakeLists.txt
index 292a1bd639fb..25fff72d3dcf 100644
--- a/llvm/utils/TableGen/GlobalISel/CMakeLists.txt
+++ b/llvm/utils/TableGen/GlobalISel/CMakeLists.txt
@@ -1,5 +1,6 @@
 set(LLVM_LINK_COMPONENTS
   Support
+  TableGen
   )
 
 llvm_add_library(LLVMTableGenGlobalISel STATIC DISABLE_LLVM_LINK_LLVM_DYLIB


        


More information about the cfe-commits mailing list