diff options
| author | Tom Stellard <tstellar@redhat.com> | 2020-01-22 22:06:56 +0000 |
|---|---|---|
| committer | Hans Wennborg <hans@chromium.org> | 2020-01-23 01:19:33 +0100 |
| commit | 3e429b691ec89de09324d6af33e35f1491f45b7d (patch) | |
| tree | bc0f8d7b6efe3231c4c07cd3f9467059ec1f9e8a | |
| parent | 6c9da109c9cee54b494b03edbfd1648b685331c3 (diff) | |
| download | bcm5719-llvm-3e429b691ec89de09324d6af33e35f1491f45b7d.tar.gz bcm5719-llvm-3e429b691ec89de09324d6af33e35f1491f45b7d.zip | |
[cmake] Fix clang builds with BUILD_SHARED=ON and CLANG_LINK_CLANG_DYLIB=ON
Summary:
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.
Reviewers: beanz, mgorny
Reviewed By: beanz, mgorny
Subscribers: mgorny, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D68520
(cherry picked from commit df839cfda09dbadc26b8be635f27da75f1f27190)
| -rw-r--r-- | clang/tools/clang-shlib/CMakeLists.txt | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/tools/clang-shlib/CMakeLists.txt b/clang/tools/clang-shlib/CMakeLists.txt index a0fc8f6bfbd..16fc8a0ca29 100644 --- a/clang/tools/clang-shlib/CMakeLists.txt +++ b/clang/tools/clang-shlib/CMakeLists.txt @@ -14,9 +14,17 @@ foreach (lib ${clang_libs}) list(APPEND _OBJECTS $<TARGET_OBJECTS:obj.${lib}>) endif() list(APPEND _DEPS $<TARGET_PROPERTY:${lib},INTERFACE_LINK_LIBRARIES>) - list(APPEND _DEPS $<TARGET_PROPERTY:${lib},LINK_LIBRARIES>) + get_target_property(interface ${lib} LINK_LIBRARIES) + if (interface) + list(APPEND _DEPS ${interface}) + endif() 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() |

