diff options
author | Petr Hosek <phosek@chromium.org> | 2019-04-17 21:41:09 +0000 |
---|---|---|
committer | Petr Hosek <phosek@chromium.org> | 2019-04-17 21:41:09 +0000 |
commit | 1788b89b4feddce4874a92a7008da956d4813825 (patch) | |
tree | dc0692b6b8a7210ecd278790b0ceb72176cfa514 /libcxx/lib | |
parent | daf6e66ac5d2f5305f493e90923d11b91a27e7b3 (diff) | |
download | bcm5719-llvm-1788b89b4feddce4874a92a7008da956d4813825.tar.gz bcm5719-llvm-1788b89b4feddce4874a92a7008da956d4813825.zip |
[CMake] Split linked libraries for shared and static libc++
Some linker libraries are only needed for shared libc++, some only
for static libc++, combining these together in LIBCXX_LIBRARIES and
LIBCXX_INTERFACE_LIBRARIES can introduce unnecessary dependencies.
This changes splits those up into LIBCXX_SHARED_LIBRARIES and
LIBCXX_STATIC_LIBRARIES matching what libc++abi already does.
Differential Revision: https://reviews.llvm.org/D57872
llvm-svn: 358614
Diffstat (limited to 'libcxx/lib')
-rw-r--r-- | libcxx/lib/CMakeLists.txt | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/libcxx/lib/CMakeLists.txt b/libcxx/lib/CMakeLists.txt index b3eb5c88b6c..3a562e05226 100644 --- a/libcxx/lib/CMakeLists.txt +++ b/libcxx/lib/CMakeLists.txt @@ -90,17 +90,6 @@ endif() add_library_flags_if(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB atomic) add_library_flags_if(MINGW "${MINGW_LIBRARIES}") -# Add the unwinder library. -if (LIBCXXABI_USE_LLVM_UNWINDER) - if (NOT LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_shared OR HAVE_LIBUNWIND)) - add_interface_library(unwind_shared) - elseif (LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_static OR HAVE_LIBUNWIND)) - add_interface_library(unwind_static) - else() - add_interface_library(unwind) - endif() -endif() - # Setup flags. add_link_flags_if_supported(-nodefaultlibs) @@ -171,6 +160,19 @@ if (LIBCXX_ENABLE_SHARED) ) cxx_set_common_defines(cxx_shared) + # Link against LLVM libunwind + if (LIBCXXABI_USE_LLVM_UNWINDER) + if (NOT LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY AND (TARGET unwind_shared OR HAVE_LIBUNWIND)) + target_link_libraries(cxx_shared PRIVATE unwind_shared) + list(APPEND LIBCXX_INTERFACE_LIBRARIES unwind_shared) # For the linker script + elseif (LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY AND (TARGET unwind_static OR HAVE_LIBUNWIND)) + # libunwind is already included in libc++abi + else() + target_link_libraries(cxx_shared PRIVATE unwind) + list(APPEND LIBCXX_INTERFACE_LIBRARIES unwind) # For the linker script + endif() + endif() + # Link against libc++abi if (LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY) if (APPLE) |