aboutsummaryrefslogtreecommitdiff
path: root/libcxxabi
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2022-08-20 11:04:41 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2022-08-21 08:22:57 -0400
commite6a0800532bb409f6d1c62f3698bdd6994a877dc (patch)
tree359bf07db00a9fa1a126a0c3458cf4782a1c692a /libcxxabi
parent176db3b3ab25ff8a9b2405f50ef5a8bd9304a6d5 (diff)
downloadllvm-e6a0800532bb409f6d1c62f3698bdd6994a877dc.zip
llvm-e6a0800532bb409f6d1c62f3698bdd6994a877dc.tar.gz
llvm-e6a0800532bb409f6d1c62f3698bdd6994a877dc.tar.bz2
[libcxxabi][cmake] Allow building without libcxx again
This allows `-DLLVM_ENABLE_RUNTIMES=libcxxabi` to work. This functionality was removed in D125561 (among other such removals) as dead code, because it was only available as part of the standalone build before. The functionality as added back as it was, except `target_include_directories` is used instead of the cruder `target_compile_options` (with an MSVC vs not MSVC conditional split). That is just wholly better. Reviewed By: phosek, #libc_abi Differential Revision: https://reviews.llvm.org/D132298
Diffstat (limited to 'libcxxabi')
-rw-r--r--libcxxabi/CMakeLists.txt11
-rw-r--r--libcxxabi/test/CMakeLists.txt10
2 files changed, 16 insertions, 5 deletions
diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
index b8326d0..9064afb 100644
--- a/libcxxabi/CMakeLists.txt
+++ b/libcxxabi/CMakeLists.txt
@@ -131,10 +131,17 @@ if (NOT LIBCXXABI_ENABLE_SHARED AND NOT LIBCXXABI_ENABLE_STATIC)
message(FATAL_ERROR "libc++abi must be built as either a shared or static library.")
endif()
-# TODO: Remove this, which shouldn't be necessary since we know we're being built
-# side-by-side with libc++.
set(LIBCXXABI_LIBCXX_INCLUDES "" CACHE PATH
"Specify path to libc++ includes.")
+if (NOT libcxx IN_LIST LLVM_ENABLE_RUNTIMES)
+ if (NOT IS_DIRECTORY ${LIBCXXABI_LIBCXX_INCLUDES})
+ message(FATAL_ERROR
+ "LIBCXXABI_LIBCXX_INCLUDES=${LIBCXXABI_LIBCXX_INCLUDES} is not a valid directory. "
+ "Please provide the path to where the libc++ headers have been installed.")
+ endif()
+ add_library(cxx-headers INTERFACE)
+ target_include_directories(cxx-headers INTERFACE "${LIBCXXABI_LIBCXX_INCLUDES}")
+endif()
set(LIBCXXABI_HERMETIC_STATIC_LIBRARY_DEFAULT OFF)
if (WIN32)
diff --git a/libcxxabi/test/CMakeLists.txt b/libcxxabi/test/CMakeLists.txt
index 0a4541b..0b82943 100644
--- a/libcxxabi/test/CMakeLists.txt
+++ b/libcxxabi/test/CMakeLists.txt
@@ -61,9 +61,13 @@ if (LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY)
list(APPEND LIBCXXABI_TEST_DEPS cxx_external_threads)
endif()
-list(APPEND LIBCXXABI_TEST_DEPS cxx)
-if (LIBCXXABI_USE_LLVM_UNWINDER AND TARGET unwind)
- list(APPEND LIBCXXABI_TEST_DEPS unwind)
+if(libcxx IN_LIST LLVM_ENABLE_RUNTIMES)
+ list(APPEND LIBCXXABI_TEST_DEPS cxx)
+endif()
+if(libunwind IN_LIST LLVM_ENABLE_RUNTIMES)
+ if (LIBCXXABI_USE_LLVM_UNWINDER AND TARGET unwind)
+ list(APPEND LIBCXXABI_TEST_DEPS unwind)
+ endif()
endif()
set(AUTO_GEN_COMMENT "## Autogenerated by libcxxabi configuration.\n# Do not edit!")