[PATCH] D134637: clang-tblgen build: avoid duplicate inclusion of libLLVMSupport

Nicolai Hähnle via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 4 23:18:25 PDT 2022


nhaehnle updated this revision to Diff 465284.
nhaehnle added a comment.

Remove the confusing "accidentally"


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134637/new/

https://reviews.llvm.org/D134637

Files:
  clang/lib/Support/CMakeLists.txt
  clang/utils/TableGen/CMakeLists.txt


Index: clang/utils/TableGen/CMakeLists.txt
===================================================================
--- clang/utils/TableGen/CMakeLists.txt
+++ clang/utils/TableGen/CMakeLists.txt
@@ -25,6 +25,6 @@
   TableGen.cpp
   )
 
-target_link_libraries(clang-tblgen PRIVATE clangSupport)
+target_link_libraries(clang-tblgen PRIVATE clangSupport_tablegen)
 
 set_target_properties(clang-tblgen PROPERTIES FOLDER "Clang tablegenning")
Index: clang/lib/Support/CMakeLists.txt
===================================================================
--- clang/lib/Support/CMakeLists.txt
+++ clang/lib/Support/CMakeLists.txt
@@ -9,8 +9,22 @@
   Support
   )
 
-add_clang_library(clangSupport
+set(clangSupport_sources
   RISCVVIntrinsicUtils.cpp
   )
 
+add_clang_library(clangSupport ${clangSupport_sources})
+
+if (LLVM_LINK_LLVM_DYLIB)
+  # Build a version of the support library that does not link against
+  # libLLVM-*.so, to be used by clang-tblgen. This is so clang-tblgen doesn't
+  # link against libLLVMSupport twice (once statically and once via
+  # libLLVM-*.so).
+  add_llvm_library(clangSupport_tablegen
+    BUILDTREE_ONLY STATIC DISABLE_LLVM_LINK_LLVM_DYLIB
+    ${clangSupport_sources})
+else()
+  add_library(clangSupport_tablegen ALIAS clangSupport)
+endif()
+
 set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS_OLD})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134637.465284.patch
Type: text/x-patch
Size: 1327 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221005/43343f4f/attachment.bin>


More information about the cfe-commits mailing list