[clang] 1d68a78 - [clang-shlib] Don't link with static clang libraries

Tom Stellard via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 10 14:28:49 PDT 2020


Author: Tom Stellard
Date: 2020-07-10T14:28:05-07:00
New Revision: 1d68a780b34e1f18f865d0754fce6c6177dc5d21

URL: https://github.com/llvm/llvm-project/commit/1d68a780b34e1f18f865d0754fce6c6177dc5d21
DIFF: https://github.com/llvm/llvm-project/commit/1d68a780b34e1f18f865d0754fce6c6177dc5d21.diff

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

Summary:
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.

Reviewers: smeenai

Reviewed By: smeenai

Subscribers: mgorny, cfe-commits, llvm-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D82694

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/tools/clang-shlib/CMakeLists.txt b/clang/tools/clang-shlib/CMakeLists.txt
index 07ee0f0a9a92..5949223fc8e3 100644
--- a/clang/tools/clang-shlib/CMakeLists.txt
+++ b/clang/tools/clang-shlib/CMakeLists.txt
@@ -13,7 +13,12 @@ foreach (lib ${clang_libs})
   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.


        


More information about the cfe-commits mailing list