diff options
author | Shoaib Meenai <smeenai@fb.com> | 2019-07-12 17:23:35 +0000 |
---|---|---|
committer | Shoaib Meenai <smeenai@fb.com> | 2019-07-12 17:23:35 +0000 |
commit | aaa490346ce79baa0168cdbd24d6adaa5a75df95 (patch) | |
tree | 9d9b908a2fed84f9661751cfec35d96c866d8c16 | |
parent | c2ac925d6e1599f9c667a16196bd36888df02e1e (diff) | |
download | bcm5719-llvm-aaa490346ce79baa0168cdbd24d6adaa5a75df95.tar.gz bcm5719-llvm-aaa490346ce79baa0168cdbd24d6adaa5a75df95.zip |
Revert [clang-shlib] Fix clang-shlib for PRIVATE dependencies
This reverts r365825 (git commit 3173c60f96c3ccfc17d403a192ae58e720153c23)
This is breaking BUILD_SHARED_LIBS=ON builds. Reverting while I rethink it.
llvm-svn: 365922
-rw-r--r-- | clang/tools/clang-shlib/CMakeLists.txt | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/clang/tools/clang-shlib/CMakeLists.txt b/clang/tools/clang-shlib/CMakeLists.txt index 1ba6ec74a93..4e9e8c1fa3b 100644 --- a/clang/tools/clang-shlib/CMakeLists.txt +++ b/clang/tools/clang-shlib/CMakeLists.txt @@ -7,35 +7,8 @@ get_property(clang_libs GLOBAL PROPERTY CLANG_STATIC_LIBS) foreach (lib ${clang_libs}) list(APPEND _OBJECTS $<TARGET_OBJECTS:obj.${lib}>) - # Use the static library for its dependencies. The objects that constitute the - # static library will appear on the link line before the library, so it'll - # just be ignored, but the dependencies of the library will still be linked - # correctly. - # - # We could propagate the dependencies manually using the library's - # INTERFACE_LINK_LIBRARIES property, but that will contain $<LINK_ONLY:...> - # generator expressions if a static library has a private dependency, so we - # can't use a $<TARGET_PROPERTY:...> generator expression to get the property - # (since it wouldn't evaluate any generator expressions inside the property). - # We could use get_property and do string manipulation to manually evaluate - # the $<LINK_ONLY:...>, but that would miss any dependencies added after we - # evaluate the get_property. We could also use the LINK_LIBRARIES property - # instead, which should be free of any generator expressions, but that's - # technically incorrect (it'd most likely work fine in practice, but still). - # - # Another alternative would be to use --whole-archive or equivalent instead of - # using the object library at all. However, CMake reorders static libraries on - # the link line so that a library appears after all its dependents, which can - # reorder static libraries out of their --whole-archive --no-whole-archive - # sandwich. It's really hard to avoid that reordering while still propagating - # dependencies, which defeats the whole point. - # - # The ideal solution here is to bump our minimum CMake requirement to 3.12, - # which adds support for dependencies on object libraries. Until then, linking - # both the object and the static libraries seems like the least bad solution. - # - # TODO: Rework this when we bump our minimum CMake version to 3.12 or newer. - list(APPEND _DEPS ${lib}) + list(APPEND _DEPS $<TARGET_PROPERTY:${lib},INTERFACE_LINK_LIBRARIES>) + list(APPEND _DEPS $<TARGET_PROPERTY:${lib},LINK_LIBRARIES>) endforeach () if (CLANG_LINK_CLANG_DYLIB) |