Skip to content

Commit

Permalink
[libcxx][CMake] Support in-tree libunwind when building as part of ru…
Browse files Browse the repository at this point in the history
…ntimes

When building as part of runtimes, there is no predefined order in
which the runtimes are loaded, so the targets from other projects
might not be available. We need to rely on HAVE_<name> variables
instead in that case.

Differential Revision: https://reviews.llvm.org/D29575

llvm-svn: 294553
  • Loading branch information
petrhosek committed Feb 9, 2017
1 parent ef6f231 commit b494288
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions libcxx/CMakeLists.txt
Expand Up @@ -158,6 +158,7 @@ option(LIBCXX_ENABLE_ABI_LINKER_SCRIPT
# Build libc++abi with libunwind. We need this option to determine whether to
# link with libunwind or libgcc_s while running the test cases.
option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF)
option(LIBCXXABI_ENABLE_STATIC_UNWINDER "Statically link the LLVM unwinder." OFF)

# Target options --------------------------------------------------------------
option(LIBCXX_BUILD_32_BITS "Build 32 bit libc++." ${LLVM_BUILD_32_BITS})
Expand Down
4 changes: 2 additions & 2 deletions libcxx/lib/CMakeLists.txt
Expand Up @@ -89,9 +89,9 @@ add_library_flags_if(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB atomic)

# Add the unwinder library.
if (LIBCXXABI_USE_LLVM_UNWINDER)
if (TARGET unwind_shared)
if (NOT LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_shared OR HAVE_LIBUNWIND))
add_interface_library(unwind_shared)
elseif (TARGET unwind_static)
elseif (LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_static OR HAVE_LIBUNWIND))
add_interface_library(unwind_static)
else()
add_interface_library(unwind)
Expand Down

0 comments on commit b494288

Please sign in to comment.