[PATCH] D82694: [clang-shlib] Don't link with static clang libraries

Tom Stellard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 26 17:05:17 PDT 2020


tstellar created this revision.
tstellar added a reviewer: smeenai.
Herald added subscribers: cfe-commits, mgorny.
Herald added a project: clang.

If we are building static libraries we don't need to link them into
clang-shlib, since clang-shlib already has all the individual object
files linked in.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82694

Files:
  clang/tools/clang-shlib/CMakeLists.txt


Index: clang/tools/clang-shlib/CMakeLists.txt
===================================================================
--- clang/tools/clang-shlib/CMakeLists.txt
+++ clang/tools/clang-shlib/CMakeLists.txt
@@ -13,7 +13,12 @@
   else()
     list(APPEND _OBJECTS $<TARGET_OBJECTS:obj.${lib}>)
   endif()
-  list(APPEND _DEPS $<TARGET_PROPERTY:${lib},INTERFACE_LINK_LIBRARIES>)
+  if (BUILD_SHARED_LIBS)
+    # If we are building static libraries, then we don't need to add the static
+    # libraries as a depedency, because we are already linking against the
+    # individual object files.
+    list(APPEND _DEPS $<TARGET_PROPERTY:${lib},INTERFACE_LINK_LIBRARIES>)
+  endif()
 
   # clang libraries are redundant since we are linking all the individual
   # object files into libclang-cpp.so, so filter them out from _DEPS.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82694.273865.patch
Type: text/x-patch
Size: 818 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200627/21c91a8e/attachment-0001.bin>


More information about the llvm-commits mailing list