[libunwind] Support building hermetic static library This is useful when the static libunwind library is being linked into shared libraries that may be used in with other shared libraries that use different unwinder. We want to avoid avoid exporting libunwind symbols in those cases. This achieved by a new CMake option which can be enabled by libunwind vendors as needed. The same CMake option has already been added to libc++ and libc++abi in D55404 and D56026. Differential Revision: https://reviews.llvm.org/D57107 git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@352559 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 77722e6..246cfd8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt
@@ -218,7 +218,11 @@ if (LIBCXXABI_ENABLE_STATIC) if (LIBCXXABI_USE_LLVM_UNWINDER AND LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY) if (TARGET unwind_static OR HAVE_LIBUNWIND) - list(APPEND cxxabi_static_sources $<TARGET_OBJECTS:unwind_objects>) + if(LIBUNWIND_HERMETIC_STATIC_LIBRARY) + list(APPEND cxxabi_static_sources $<TARGET_OBJECTS:unwind_static_objects>) + else() + list(APPEND cxxabi_static_sources $<TARGET_OBJECTS:unwind_objects>) + endif() endif() endif() add_library(cxxabi_static STATIC ${cxxabi_static_sources})