[PATCH] D68520: [cmake] Fix clang builds with BUILD_SHARED=ON and CLANG_LINK_CLANG_DYLIB=ON
Tom Stellard via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 4 15:27:16 PDT 2019
tstellar created this revision.
tstellar added a reviewer: beanz.
Herald added a subscriber: mgorny.
Herald added a project: clang.
We were linking all the clang objects and shared libraries into
libclang-cpp.so, which was causing the command line options to be
registered twice.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D68520
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
@@ -8,9 +8,15 @@
foreach (lib ${clang_libs})
list(APPEND _OBJECTS $<TARGET_OBJECTS:obj.${lib}>)
list(APPEND _DEPS $<TARGET_PROPERTY:${lib},INTERFACE_LINK_LIBRARIES>)
- list(APPEND _DEPS $<TARGET_PROPERTY:${lib},LINK_LIBRARIES>)
+ get_target_property(interface ${lib} LINK_LIBRARIES)
+ list(APPEND _DEPS ${interface})
endforeach ()
+# clang libraries are redundant since we are linking all the individual
+# object files into libclang-cpp.so, so filter them out from _DEPS.
+# This avoids problems with LLVM global data when building with
+# BUILD_SHARED_LIBS=ON
+list(FILTER _DEPS EXCLUDE REGEX "^clang")
if (CLANG_LINK_CLANG_DYLIB)
set(INSTALL_WITH_TOOLCHAIN INSTALL_WITH_TOOLCHAIN)
endif()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68520.223325.patch
Type: text/x-patch
Size: 910 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191004/1edee750/attachment.bin>
More information about the cfe-commits
mailing list