2017-05-31 16:09:20 -08:00
# See www/CMake.html for instructions on how to build libcxxabi with CMake.
2014-07-03 11:35:48 -08:00
#===============================================================================
# Setup Project
#===============================================================================
Reland "[CMake] Bumps minimum version to 3.20.0.
This reverts commit d763c6e5e2d0a6b34097aa7dabca31e9aff9b0b6.
Adds the patch by @hans from
https://github.com/llvm/llvm-project/issues/62719
This patch fixes the Windows build.
d763c6e5e2d0a6b34097aa7dabca31e9aff9b0b6 reverted the reviews
D144509 [CMake] Bumps minimum version to 3.20.0.
This partly undoes D137724.
This change has been discussed on discourse
https://discourse.llvm.org/t/rfc-upgrading-llvms-minimum-required-cmake-version/66193
Note this does not remove work-arounds for older CMake versions, that
will be done in followup patches.
D150532 [OpenMP] Compile assembly files as ASM, not C
Since CMake 3.20, CMake explicitly passes "-x c" (or equivalent)
when compiling a file which has been set as having the language
C. This behaviour change only takes place if "cmake_minimum_required"
is set to 3.20 or newer, or if the policy CMP0119 is set to new.
Attempting to compile assembly files with "-x c" fails, however
this is workarounded in many cases, as OpenMP overrides this with
"-x assembler-with-cpp", however this is only added for non-Windows
targets.
Thus, after increasing cmake_minimum_required to 3.20, this breaks
compiling the GNU assembly for Windows targets; the GNU assembly is
used for ARM and AArch64 Windows targets when building with Clang.
This patch unbreaks that.
D150688 [cmake] Set CMP0091 to fix Windows builds after the cmake_minimum_required bump
The build uses other mechanism to select the runtime.
Fixes #62719
Reviewed By: #libc, Mordante
Differential Revision: https://reviews.llvm.org/D151344
2023-05-24 08:12:32 -08:00
cmake_minimum_required(VERSION 3.20.0)
2026-06-29 10:16:27 -08:00
if("${CMAKE_VERSION}" VERSION_LESS "3.31.0")
message(WARNING
"Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 24, the "
"minimum version of CMake required to build LLVM will become 3.31.0, and "
"using an older CMake will become an error. Please upgrade your CMake to "
"at least 3.31.0 now to avoid issues in the future.")
endif()
2024-05-25 07:41:21 -08:00
set(LLVM_SUBPROJECT_TITLE "libc++abi")
2014-07-03 11:35:48 -08:00
2021-12-31 22:03:31 -09:00
set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
2017-04-07 12:10:41 -08:00
# Add path for custom modules
2021-12-31 22:03:31 -09:00
list(INSERT CMAKE_MODULE_PATH 0
2017-04-07 12:10:41 -08:00
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
2023-02-20 06:26:19 -09:00
"${CMAKE_CURRENT_SOURCE_DIR}/../runtimes/cmake/Modules"
2021-12-31 22:03:31 -09:00
"${LLVM_COMMON_CMAKE_UTILS}"
"${LLVM_COMMON_CMAKE_UTILS}/Modules"
2017-04-07 12:10:41 -08:00
)
2021-01-24 23:50:03 -09:00
set(CMAKE_FOLDER "libc++")
2020-08-24 01:01:05 -08:00
set(LIBCXXABI_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(LIBCXXABI_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(LIBCXXABI_LIBCXX_PATH "${CMAKE_CURRENT_LIST_DIR}/../libcxx" CACHE PATH
"Specify path to libc++ source.")
2022-01-18 21:45:07 -09:00
include(GNUInstallDirs)
2017-05-31 16:09:20 -08:00
# Require out of source build.
include(MacroEnsureOutOfSourceBuild)
MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
"${PROJECT_NAME} requires an out of source build. Please create a separate
build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there."
)
2024-12-11 08:49:06 -09:00
if (MSVC)
message(FATAL_ERROR "Libc++abi can't be built for MSVC targets, and doing so is pointless anyway because such "
"targets must use the MS C++ ABI, and libc++abi provides the Itanium C++ ABI.")
endif()
2014-07-03 11:35:48 -08:00
#===============================================================================
# Setup CMake Options
#===============================================================================
2017-05-31 16:09:20 -08:00
include(CMakeDependentOption)
2017-04-07 12:10:41 -08:00
include(HandleCompilerRT)
2014-07-03 11:35:48 -08:00
# Define options.
2019-07-12 11:10:59 -08:00
option(LIBCXXABI_ENABLE_EXCEPTIONS
"Provide support for exceptions in the runtime.
When disabled, libc++abi does not support stack unwinding and other exceptions-related features." ON)
2014-07-03 11:35:48 -08:00
option(LIBCXXABI_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
2023-02-17 01:31:41 -09:00
option(LIBCXXABI_ENABLE_PEDANTIC "Compile with pedantic enabled." OFF)
2014-07-03 11:35:48 -08:00
option(LIBCXXABI_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
2024-01-11 06:13:21 -09:00
option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." ON)
2024-01-15 06:16:32 -09:00
if (LIBCXXABI_USE_LLVM_UNWINDER AND NOT "libunwind" IN_LIST LLVM_ENABLE_RUNTIMES)
2024-01-16 06:55:56 -09:00
message(FATAL_ERROR "LIBCXXABI_USE_LLVM_UNWINDER is set to ON, but libunwind is not specified in LLVM_ENABLE_RUNTIMES.")
2024-01-15 06:16:32 -09:00
endif()
2017-02-08 17:19:30 -09:00
option(LIBCXXABI_ENABLE_STATIC_UNWINDER "Statically link the LLVM unwinder." OFF)
2016-07-14 16:49:42 -08:00
option(LIBCXXABI_USE_COMPILER_RT "Use compiler-rt instead of libgcc" OFF)
2014-11-24 13:42:03 -09:00
option(LIBCXXABI_ENABLE_THREADS "Build with threads enabled" ON)
2016-05-25 09:37:38 -08:00
option(LIBCXXABI_HAS_PTHREAD_API "Ignore auto-detection and force use of pthread API" OFF)
2021-03-05 05:30:13 -09:00
option(LIBCXXABI_HAS_WIN32_THREAD_API "Ignore auto-detection and force use of win32 thread API" OFF)
2017-01-03 03:58:34 -09:00
option(LIBCXXABI_HAS_EXTERNAL_THREAD_API
"Build libc++abi with an externalized threading API.
This option may only be set to ON when LIBCXXABI_ENABLE_THREADS=ON." OFF)
2026-01-09 01:58:29 -09:00
set(LIBCXXABI_AVAILABILITY_MINIMUM_HEADER_VERSION "2" CACHE STRING
"Minimum version of the libc++ headers that are allowed to be used by binaries linked against the libc++ library. This
version must correspond to the major version of an LLVM release.")
2020-04-22 12:17:58 -08:00
option(LIBCXXABI_ENABLE_FORGIVING_DYNAMIC_CAST
"Make dynamic_cast more forgiving when type_info's mistakenly have hidden \
visibility, and thus multiple type_infos can exist for a single type. \
When the dynamic_cast would normally fail, this option will cause the \
library to try comparing the type_info names to see if they are equal \
instead." OFF)
2017-03-02 12:55:17 -09:00
2017-03-02 10:34:35 -09:00
option(LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS
[libc++] Define new/delete in libc++abi only by default
Previously, we would define new/delete in both libc++ and libc++abi.
Not only does this cause code bloat, but also it's technically an ODR
violation since we don't know which operator will be selected. Furthermore,
since those are weak definitions, we should strive to have as few of them
as possible (to improve load times).
My preferred choice would have been to put the operators in libc++ only
by default, however that would create a circular dependency between
libc++ and libc++abi, which GNU linkers don't handle.
Folks who want to ship new/delete in libc++ instead of libc++abi are
free to do so by turning on LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS at
CMake configure time.
On Apple platforms, this shouldn't be an ABI break because we re-export
the new/delete symbols from libc++abi. This change actually makes libc++
behave closer to the system libc++ shipped on Apple platforms.
On other platforms, this is an ABI break for people linking against libc++
but not libc++abi. However, vendors have been consulted in D68269 and no
objection was raised. Furthermore, the definitions can be controlled to
appear in libc++ instead with the CMake option.
Differential Revision: https://reviews.llvm.org/D68269
2019-10-01 05:34:58 -08:00
"Build libc++abi with definitions for operator new/delete. These are normally
defined in libc++abi, but it is also possible to define them in libc++, in
which case the definition in libc++abi should be turned off." ON)
2021-11-23 12:34:09 -09:00
option(LIBCXXABI_BUILD_32_BITS "Build 32 bit multilib libc++abi. This option is not supported anymore when building the runtimes. Please specify a full triple instead." ${LLVM_BUILD_32_BITS})
if (LIBCXXABI_BUILD_32_BITS)
2021-12-01 08:57:30 -09:00
message(FATAL_ERROR "LIBCXXABI_BUILD_32_BITS is not supported anymore when building the runtimes, please specify a full triple instead.")
2021-11-23 12:34:09 -09:00
endif()
2017-01-07 13:14:04 -09:00
option(LIBCXXABI_INCLUDE_TESTS "Generate build targets for the libc++abi unit tests." ${LLVM_INCLUDE_TESTS})
2022-08-18 18:44:46 -08:00
set(LIBCXXABI_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
"Define suffix of library directory name (32/64)")
2022-02-17 07:19:45 -09:00
option(LIBCXXABI_INSTALL_HEADERS "Install the libc++abi headers." ON)
2017-11-17 14:25:09 -09:00
option(LIBCXXABI_INSTALL_LIBRARY "Install the libc++abi library." ON)
2022-05-13 18:23:52 -08:00
2026-06-29 07:53:09 -08:00
# On platforms that don't support shared library targets
# (e.g. CMAKE_SYSTEM_NAME of "Generic", used for GPU and other
# baremetal targets), the shared library target is not built at
# all. The global TARGET_SUPPORTS_SHARED_LIBS property is left
# undefined on platforms that do support shared libraries, and only
# set to FALSE on those that don't. See
# https://gitlab.kitware.com/cmake/cmake/-/issues/25759.
get_property(LIBCXXABI_TARGET_SUPPORTS_SHARED_LIBS GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)
if(NOT DEFINED LIBCXXABI_TARGET_SUPPORTS_SHARED_LIBS OR LIBCXXABI_TARGET_SUPPORTS_SHARED_LIBS)
set(LIBCXXABI_SUPPORTS_SHARED_LIBRARY ON)
else()
set(LIBCXXABI_SUPPORTS_SHARED_LIBRARY OFF)
endif()
2022-10-11 06:05:56 -08:00
set(LIBCXXABI_SHARED_OUTPUT_NAME "c++abi" CACHE STRING "Output name for the shared libc++abi runtime library.")
set(LIBCXXABI_STATIC_OUTPUT_NAME "c++abi" CACHE STRING "Output name for the static libc++abi runtime library.")
2023-08-14 14:14:02 -08:00
set(LIBCXXABI_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/c++/v1" CACHE STRING "Path to install the libc++abi headers at.")
2022-05-13 18:23:52 -08:00
2025-01-14 09:23:07 -09:00
if(LLVM_LIBRARY_OUTPUT_INTDIR)
set(LIBCXXABI_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1")
else()
set(LIBCXXABI_GENERATED_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include/c++/v1")
endif()
2016-06-01 04:50:30 -08:00
set(LIBCXXABI_LIBCXX_LIBRARY_PATH "" CACHE PATH "The path to libc++ library.")
2019-10-07 11:22:04 -08:00
set(LIBCXXABI_LIBRARY_VERSION "1.0" CACHE STRING
"Version of libc++abi. This will be reflected in the name of the shared \
library produced. For example, -DLIBCXXABI_LIBRARY_VERSION=x.y will \
result in the library being named libc++abi.x.y.dylib, along with the \
usual symlinks pointing to that.")
2014-07-09 18:20:11 -08:00
# Default to building a shared library so that the default options still test
2022-05-13 08:15:15 -08:00
# the libc++abi that is being built. The problem with testing a static libc++abi
# is that libc++ will prefer a dynamic libc++abi from the system over a static
# libc++abi from the output directory.
2014-07-09 18:20:11 -08:00
option(LIBCXXABI_ENABLE_SHARED "Build libc++abi as a shared library." ON)
2015-03-03 06:59:09 -09:00
option(LIBCXXABI_ENABLE_STATIC "Build libc++abi as a static library." ON)
2018-07-25 15:13:00 -08:00
cmake_dependent_option(LIBCXXABI_INSTALL_STATIC_LIBRARY
"Install the static libc++abi library." ON
"LIBCXXABI_ENABLE_STATIC;LIBCXXABI_INSTALL_LIBRARY" OFF)
cmake_dependent_option(LIBCXXABI_INSTALL_SHARED_LIBRARY
"Install the shared libc++abi library." ON
"LIBCXXABI_ENABLE_SHARED;LIBCXXABI_INSTALL_LIBRARY" OFF)
2018-07-23 23:06:17 -08:00
cmake_dependent_option(LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY
"Statically link the LLVM unwinder to static library" ON
2022-05-18 08:05:45 -08:00
"LIBCXXABI_ENABLE_STATIC_UNWINDER" OFF)
2018-07-23 23:06:17 -08:00
cmake_dependent_option(LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY
"Statically link the LLVM unwinder to shared library" ON
2022-05-18 08:05:45 -08:00
"LIBCXXABI_ENABLE_STATIC_UNWINDER" OFF)
2018-07-23 23:06:17 -08:00
2017-03-01 02:42:01 -09:00
option(LIBCXXABI_BAREMETAL "Build libc++abi for baremetal targets." OFF)
# The default terminate handler attempts to demangle uncaught exceptions, which
# causes extra I/O and demangling code to be pulled in.
option(LIBCXXABI_SILENT_TERMINATE "Set this to make the terminate handler default to a silent alternative" OFF)
2021-01-21 12:27:14 -09:00
option(LIBCXXABI_NON_DEMANGLING_TERMINATE "Set this to make the terminate handler
avoid demangling" OFF)
2017-03-01 02:42:01 -09:00
2015-03-03 06:59:09 -09:00
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()
2014-07-09 18:20:11 -08:00
[runtimes] Default LIB*_HERMETIC_STATIC_LIBRARY to ON on Windows
(In the case of libunwind, the cmake option is called
LIBUNWIND_HIDE_SYMBOLS, but it has the same effect as
LIBCXX_HERMETIC_STATIC_LIBRARY and
LIBCXXABI_HERMETIC_STATIC_LIBRARY.)
Previously, the same issue was dealt with by setting a project wide
define (_LIBUNWIND_HIDE_SYMBOLS,
_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS and
_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) if only building a static
library. If building both static and shared at the same time, this
wasn't set, and the static library would contain dllexport directives.
The LIB*_HERMETIC_STATIC_LIBRARY and LIBUNWIND_HIDE_SYMBOLS cmake
options only apply the defines to the static library in the build,
even if building both static and shared at the same time.
(This could only be done use after the object libraries were
enabled, as a shared libcxx needs libcxxabi object files built
with dllexports included.)
This allows removing inelegant code for deciding how to build the
libcxxabi static library and a TODO comment that suggested that
users should need to start setting an option, which they shouldn't
need to. Finally, this gets rid of two XFAILs in tests.
Differential Revision: https://reviews.llvm.org/D125715
2022-04-09 12:40:07 -08:00
set(LIBCXXABI_HERMETIC_STATIC_LIBRARY_DEFAULT OFF)
if (WIN32)
set(LIBCXXABI_HERMETIC_STATIC_LIBRARY_DEFAULT ON)
endif()
2019-01-23 18:18:29 -09:00
option(LIBCXXABI_HERMETIC_STATIC_LIBRARY
[runtimes] Default LIB*_HERMETIC_STATIC_LIBRARY to ON on Windows
(In the case of libunwind, the cmake option is called
LIBUNWIND_HIDE_SYMBOLS, but it has the same effect as
LIBCXX_HERMETIC_STATIC_LIBRARY and
LIBCXXABI_HERMETIC_STATIC_LIBRARY.)
Previously, the same issue was dealt with by setting a project wide
define (_LIBUNWIND_HIDE_SYMBOLS,
_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS and
_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) if only building a static
library. If building both static and shared at the same time, this
wasn't set, and the static library would contain dllexport directives.
The LIB*_HERMETIC_STATIC_LIBRARY and LIBUNWIND_HIDE_SYMBOLS cmake
options only apply the defines to the static library in the build,
even if building both static and shared at the same time.
(This could only be done use after the object libraries were
enabled, as a shared libcxx needs libcxxabi object files built
with dllexports included.)
This allows removing inelegant code for deciding how to build the
libcxxabi static library and a TODO comment that suggested that
users should need to start setting an option, which they shouldn't
need to. Finally, this gets rid of two XFAILs in tests.
Differential Revision: https://reviews.llvm.org/D125715
2022-04-09 12:40:07 -08:00
"Do not export any symbols from the static library." ${LIBCXXABI_HERMETIC_STATIC_LIBRARY_DEFAULT})
2019-01-23 18:18:29 -09:00
2023-09-21 13:21:24 -08:00
if(MINGW)
2022-05-09 07:54:10 -08:00
set(LIBCXXABI_DEFAULT_TEST_CONFIG "llvm-libc++abi-mingw.cfg.in")
elseif(WIN32) # clang-cl
if (LIBCXXABI_ENABLE_SHARED)
set(LIBCXXABI_DEFAULT_TEST_CONFIG "llvm-libc++abi-shared-clangcl.cfg.in")
else()
set(LIBCXXABI_DEFAULT_TEST_CONFIG "llvm-libc++abi-static-clangcl.cfg.in")
endif()
else()
if (LIBCXXABI_ENABLE_SHARED)
set(LIBCXXABI_DEFAULT_TEST_CONFIG "llvm-libc++abi-shared.cfg.in")
else()
set(LIBCXXABI_DEFAULT_TEST_CONFIG "llvm-libc++abi-static.cfg.in")
endif()
endif()
set(LIBCXXABI_TEST_CONFIG "${LIBCXXABI_DEFAULT_TEST_CONFIG}" CACHE STRING
2021-09-29 11:26:05 -08:00
"The path to the Lit testing configuration to use when running the tests.
2021-10-12 13:45:45 -08:00
If a relative path is provided, it is assumed to be relative to '<monorepo>/libcxxabi/test/configs'.")
2021-09-29 11:26:05 -08:00
if (NOT IS_ABSOLUTE "${LIBCXXABI_TEST_CONFIG}")
2021-10-12 13:45:45 -08:00
set(LIBCXXABI_TEST_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/test/configs/${LIBCXXABI_TEST_CONFIG}")
2021-09-29 11:26:05 -08:00
endif()
2022-05-11 06:16:29 -08:00
message(STATUS "Using libc++abi testing configuration: ${LIBCXXABI_TEST_CONFIG}")
2020-07-09 07:54:09 -08:00
set(LIBCXXABI_TEST_PARAMS "" CACHE STRING
"A list of parameters to run the Lit test suite with.")
2020-06-25 07:46:00 -08:00
2014-07-03 11:35:48 -08:00
#===============================================================================
# Configure System
#===============================================================================
# Add path for custom modules
set(CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
${CMAKE_MODULE_PATH}
)
2023-08-14 14:14:02 -08:00
set(LIBCXXABI_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE STRING
2022-01-10 18:03:21 -09:00
"Path where built libc++abi runtime libraries should be installed.")
2026-04-02 02:32:14 -08:00
# TODO: Use common runtimes infrastructure for output and install paths
2018-06-27 19:11:52 -08:00
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
2024-05-31 10:48:45 -08:00
set(LIBCXXABI_TARGET_SUBDIR ${LLVM_DEFAULT_TARGET_TRIPLE})
if(LIBCXXABI_LIBDIR_SUBDIR)
string(APPEND LIBCXXABI_TARGET_SUBDIR /${LIBCXXABI_LIBDIR_SUBDIR})
endif()
2025-05-12 11:59:39 -08:00
cmake_path(NORMAL_PATH LIBCXXABI_TARGET_SUBDIR)
2021-03-10 10:21:41 -09:00
set(LIBCXXABI_HEADER_DIR ${LLVM_BINARY_DIR})
2024-05-31 10:48:45 -08:00
set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LIBCXXABI_TARGET_SUBDIR})
set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LIBCXXABI_TARGET_SUBDIR} CACHE STRING
Prepare Compiler-RT for GnuInstallDirs, matching libcxx, document all
This is a second attempt at D101497, which landed as
9a9bc76c0eb72f0f2732c729a460abbd5239c2e3 but had to be reverted in
8cf7ddbdd4e5af966a369e170c73250f2e3920e7.
This issue was that in the case that `COMPILER_RT_INSTALL_PATH` is
empty, expressions like "${COMPILER_RT_INSTALL_PATH}/bin" evaluated to
"/bin" not "bin" as intended and as was originally.
One solution is to make `COMPILER_RT_INSTALL_PATH` always non-empty,
defaulting it to `CMAKE_INSTALL_PREFIX`. D99636 adopted that approach.
But, I think it is more ergonomic to allow those project-specific paths
to be relative the global ones. Also, making install paths absolute by
default inhibits the proper behavior of functions like
`GNUInstallDirs_get_absolute_install_dir` which make relative install
paths absolute in a more complicated way.
Given all this, I will define a function like the one asked for in
https://gitlab.kitware.com/cmake/cmake/-/issues/19568 (and needed for a
similar use-case).
---
Original message:
Instead of using `COMPILER_RT_INSTALL_PATH` through the CMake for
complier-rt, just use it to define variables for the subdirs which
themselves are used.
This preserves compatibility, but later on we might consider getting rid
of `COMPILER_RT_INSTALL_PATH` and just changing the defaults for the
subdir variables directly.
---
There was a seaming bug where the (non-Apple) per-target libdir was
`${target}` not `lib/${target}`. I suspect that has to do with the docs
on `COMPILER_RT_INSTALL_PATH` saying was the library dir when that's no
longer true, so I just went ahead and fixed it, allowing me to define
fewer and more sensible variables.
That last part should be the only behavior changes; everything else
should be a pure refactoring.
---
I added some documentation of these variables too. In particular, I
wanted to highlight the gotcha where `-DSomeCachePath=...` without the
`:PATH` will lead CMake to make the path absolute. See [1] for
discussion of the problem, and [2] for the brief official documentation
they added as a result.
[1]: https://cmake.org/pipermail/cmake/2015-March/060204.html
[2]: https://cmake.org/cmake/help/latest/manual/cmake.1.html#options
In 38b2dec37ee735d5409148e71ecba278caf0f969 the problem was somewhat
misidentified and so `:STRING` was used, but `:PATH` is better as it
sets the correct type from the get-go.
---
D99484 is the main thrust of the `GnuInstallDirs` work. Once this lands,
it should be feasible to follow both of these up with a simple patch for
compiler-rt analogous to the one for libcxx.
Reviewed By: phosek, #libc_abi, #libunwind
Differential Revision: https://reviews.llvm.org/D105765
2021-04-28 14:36:47 -08:00
"Path where built libc++abi libraries should be installed.")
2025-07-03 01:07:25 -08:00
set(LIBCXXABI_INSTALL_INCLUDE_TARGET_DIR "${CMAKE_INSTALL_INCLUDEDIR}/${LIBCXXABI_TARGET_SUBDIR}/c++/v1" CACHE STRING
"Path where target-specific libc++abi headers should be installed.")
2024-05-31 10:48:45 -08:00
unset(LIBCXXABI_TARGET_SUBDIR)
2017-05-03 22:04:49 -08:00
else()
2022-01-10 18:03:21 -09:00
if(LLVM_LIBRARY_OUTPUT_INTDIR)
set(LIBCXXABI_HEADER_DIR ${LLVM_BINARY_DIR})
set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
else()
set(LIBCXXABI_HEADER_DIR ${CMAKE_BINARY_DIR})
2022-08-18 18:44:46 -08:00
set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX})
2022-01-10 18:03:21 -09:00
endif()
2023-08-14 14:14:02 -08:00
set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX} CACHE STRING
Prepare Compiler-RT for GnuInstallDirs, matching libcxx, document all
This is a second attempt at D101497, which landed as
9a9bc76c0eb72f0f2732c729a460abbd5239c2e3 but had to be reverted in
8cf7ddbdd4e5af966a369e170c73250f2e3920e7.
This issue was that in the case that `COMPILER_RT_INSTALL_PATH` is
empty, expressions like "${COMPILER_RT_INSTALL_PATH}/bin" evaluated to
"/bin" not "bin" as intended and as was originally.
One solution is to make `COMPILER_RT_INSTALL_PATH` always non-empty,
defaulting it to `CMAKE_INSTALL_PREFIX`. D99636 adopted that approach.
But, I think it is more ergonomic to allow those project-specific paths
to be relative the global ones. Also, making install paths absolute by
default inhibits the proper behavior of functions like
`GNUInstallDirs_get_absolute_install_dir` which make relative install
paths absolute in a more complicated way.
Given all this, I will define a function like the one asked for in
https://gitlab.kitware.com/cmake/cmake/-/issues/19568 (and needed for a
similar use-case).
---
Original message:
Instead of using `COMPILER_RT_INSTALL_PATH` through the CMake for
complier-rt, just use it to define variables for the subdirs which
themselves are used.
This preserves compatibility, but later on we might consider getting rid
of `COMPILER_RT_INSTALL_PATH` and just changing the defaults for the
subdir variables directly.
---
There was a seaming bug where the (non-Apple) per-target libdir was
`${target}` not `lib/${target}`. I suspect that has to do with the docs
on `COMPILER_RT_INSTALL_PATH` saying was the library dir when that's no
longer true, so I just went ahead and fixed it, allowing me to define
fewer and more sensible variables.
That last part should be the only behavior changes; everything else
should be a pure refactoring.
---
I added some documentation of these variables too. In particular, I
wanted to highlight the gotcha where `-DSomeCachePath=...` without the
`:PATH` will lead CMake to make the path absolute. See [1] for
discussion of the problem, and [2] for the brief official documentation
they added as a result.
[1]: https://cmake.org/pipermail/cmake/2015-March/060204.html
[2]: https://cmake.org/cmake/help/latest/manual/cmake.1.html#options
In 38b2dec37ee735d5409148e71ecba278caf0f969 the problem was somewhat
misidentified and so `:STRING` was used, but `:PATH` is better as it
sets the correct type from the get-go.
---
D99484 is the main thrust of the `GnuInstallDirs` work. Once this lands,
it should be feasible to follow both of these up with a simple patch for
compiler-rt analogous to the one for libcxx.
Reviewed By: phosek, #libc_abi, #libunwind
Differential Revision: https://reviews.llvm.org/D105765
2021-04-28 14:36:47 -08:00
"Path where built libc++abi libraries should be installed.")
2025-07-03 01:07:25 -08:00
set(LIBCXXABI_INSTALL_INCLUDE_TARGET_DIR "${LIBCXXABI_INSTALL_INCLUDE_DIR}" CACHE STRING
"Path where target-specific libc++abi headers should be installed.")
2017-05-03 22:04:49 -08:00
endif()
2014-12-29 03:22:04 -09:00
2016-04-18 05:30:38 -08:00
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBCXXABI_LIBRARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBCXXABI_LIBRARY_DIR})
2017-05-31 16:09:20 -08:00
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIBCXXABI_LIBRARY_DIR})
2016-04-18 05:30:38 -08:00
2022-05-13 08:15:15 -08:00
# By default, libcxx and libcxxabi share a library directory.
2016-06-01 04:50:30 -08:00
if (NOT LIBCXXABI_LIBCXX_LIBRARY_PATH)
set(LIBCXXABI_LIBCXX_LIBRARY_PATH "${LIBCXXABI_LIBRARY_DIR}" CACHE PATH
[libcxxabi] Allow tests to link with static libc++abi/libc++ even if the shared version is present
Summary:
Right now the only way to force libc++abi tests to link with the static version of libc++abi is to set `LIBCXXABI_ENABLE_SHARED` to `OFF`. However, this doesn't work when libc++abi is built as standalone project because of [this](https://github.com/llvm/llvm-project/blob/54c522420347e58aa7bae1892cf5c5672b57c875/libcxxabi/CMakeLists.txt#L503-L519).
This change allows specifying the version of the library for tests to link with.
This is useful for remote testing, for example, with `SSHExecutor`, where we _have_ to link with libc++abi statically.
Two new CMake options are introduced here: `LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXXABI` and `LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXX`. They can be set to `OFF` to tell the test utility to link tests with the static libraries.
It shouldn't break anything, because the default values of these options are set such that the test utility will behave the same way.
Reviewers: EricWF, mclow.lists, phosek, mehdi_amini, ldionne, jroelofs, bcraig
Subscribers: mgorny, christof, ldionne, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D71894
2019-12-26 00:28:39 -09:00
"The path to libc++ library." FORCE)
2016-08-08 09:59:02 -08:00
endif()
2016-06-01 18:18:31 -08:00
2017-05-31 16:09:20 -08:00
# Declare libc++abi configuration variables.
# They are intended for use as follows:
# LIBCXXABI_C_FLAGS: General flags for both the c++ compiler and linker.
# LIBCXXABI_CXX_FLAGS: General flags for both the c++ compiler and linker.
# LIBCXXABI_COMPILE_FLAGS: Compile only flags.
# LIBCXXABI_LINK_FLAGS: Linker only flags.
# LIBCXXABI_LIBRARIES: libraries libc++abi is linked to.
2016-06-01 18:18:31 -08:00
2015-01-22 04:39:08 -09:00
set(LIBCXXABI_C_FLAGS "")
2014-11-18 11:37:53 -09:00
set(LIBCXXABI_CXX_FLAGS "")
set(LIBCXXABI_COMPILE_FLAGS "")
set(LIBCXXABI_LINK_FLAGS "")
2017-05-31 16:09:20 -08:00
set(LIBCXXABI_LIBRARIES "")
2024-10-17 12:17:40 -08:00
set(LIBCXXABI_ADDITIONAL_COMPILE_FLAGS "" CACHE STRING "See documentation LIBCXX_ADDITIONAL_COMPILE_FLAGS")
2022-10-03 13:41:58 -08:00
set(LIBCXXABI_ADDITIONAL_LIBRARIES "" CACHE STRING
"Additional libraries libc++abi is linked to which can be provided in cache")
2017-05-31 16:09:20 -08:00
# Include macros for adding and removing libc++abi flags.
include(HandleLibcxxabiFlags)
#===============================================================================
# Setup Compiler Flags
#===============================================================================
2014-11-18 11:37:53 -09:00
2016-06-01 18:18:31 -08:00
# Configure target flags
2025-08-20 08:45:41 -08:00
if ("${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
2023-02-20 06:47:34 -09:00
add_flags_if_supported("-mdefault-visibility-export-mapping=explicit")
2022-06-13 17:44:58 -08:00
set(CMAKE_AIX_EXPORT_ALL_SYMBOLS OFF)
endif()
2022-10-03 13:41:58 -08:00
add_library_flags("${LIBCXXABI_ADDITIONAL_LIBRARIES}")
2022-06-13 17:44:58 -08:00
2016-06-01 18:18:31 -08:00
# Configure compiler. Must happen after setting the target flags.
include(config-ix)
2014-11-18 11:37:53 -09:00
2025-07-08 23:48:50 -08:00
include(HandleLibC) # Setup the C library flags
2022-03-10 00:47:09 -09:00
if (CXX_SUPPORTS_NOSTDINCXX_FLAG)
2014-11-18 11:37:53 -09:00
list(APPEND LIBCXXABI_COMPILE_FLAGS -nostdinc++)
2019-11-07 13:51:25 -09:00
# cmake 3.14 and above remove system include paths that are explicitly
# passed on the command line. We build with -nostdinc++ and explicitly add
# just the libcxx system include paths with -I on the command line.
# Setting CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES effectively prevents cmake
# from removing these.
# See: https://gitlab.kitware.com/cmake/cmake/issues/19227
set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "")
2014-11-18 11:37:53 -09:00
# Remove -stdlib flags to prevent them from causing an unused flag warning.
2020-10-13 06:05:00 -08:00
string(REPLACE "--stdlib=libc++" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE "--stdlib=libstdc++" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
2014-11-18 11:37:53 -09:00
string(REPLACE "-stdlib=libc++" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE "-stdlib=libstdc++" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
2014-07-03 11:35:48 -08:00
endif()
2024-12-12 17:03:12 -09:00
function(get_sanitizer_flags OUT_VAR USE_SANITIZER)
set(SANITIZER_FLAGS)
set(USE_SANITIZER "${USE_SANITIZER}")
# NOTE: LLVM_USE_SANITIZER checks for a UNIX like system instead of MSVC.
# But we don't have LLVM_ON_UNIX so checking for MSVC is the best we can do.
if (USE_SANITIZER AND NOT MSVC)
append_flags_if_supported(SANITIZER_FLAGS "-fno-omit-frame-pointer")
append_flags_if_supported(SANITIZER_FLAGS "-gline-tables-only")
if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" AND
NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
append_flags_if_supported(SANITIZER_FLAGS "-gline-tables-only")
endif()
if (USE_SANITIZER STREQUAL "Address")
append_flags(SANITIZER_FLAGS "-fsanitize=address")
elseif (USE_SANITIZER STREQUAL "HWAddress")
append_flags(SANITIZER_FLAGS "-fsanitize=hwaddress")
elseif (USE_SANITIZER MATCHES "Memory(WithOrigins)?")
append_flags(SANITIZER_FLAGS -fsanitize=memory)
if (USE_SANITIZER STREQUAL "MemoryWithOrigins")
append_flags(SANITIZER_FLAGS "-fsanitize-memory-track-origins")
endif()
elseif (USE_SANITIZER STREQUAL "Undefined")
append_flags(SANITIZER_FLAGS "-fsanitize=undefined" "-fno-sanitize=vptr,function" "-fno-sanitize-recover=all")
elseif (USE_SANITIZER STREQUAL "Address;Undefined" OR
USE_SANITIZER STREQUAL "Undefined;Address")
append_flags(SANITIZER_FLAGS "-fsanitize=address,undefined" "-fno-sanitize=vptr,function" "-fno-sanitize-recover=all")
elseif (USE_SANITIZER STREQUAL "Thread")
append_flags(SANITIZER_FLAGS -fsanitize=thread)
elseif (USE_SANITIZER STREQUAL "DataFlow")
append_flags(SANITIZER_FLAGS -fsanitize=dataflow)
else()
message(WARNING "Unsupported value of LLVM_USE_SANITIZER: ${USE_SANITIZER}")
endif()
elseif(USE_SANITIZER AND MSVC)
message(WARNING "LLVM_USE_SANITIZER is not supported on this platform.")
endif()
set(${OUT_VAR} "${SANITIZER_FLAGS}" PARENT_SCOPE)
endfunction()
get_sanitizer_flags(SANITIZER_FLAGS "${LLVM_USE_SANITIZER}")
list(APPEND LIBCXXABI_COMPILE_FLAGS ${SANITIZER_FLAGS})
2016-09-26 19:44:09 -08:00
# Let the library headers know they are currently being used to build the
# library.
add_definitions(-D_LIBCXXABI_BUILDING_LIBRARY)
2020-10-30 09:11:23 -08:00
# libcxxabi needs to, for various reasons, include the libcpp headers as if
# it is being built as part of libcxx.
add_definitions(-D_LIBCPP_BUILDING_LIBRARY)
2026-01-09 01:58:29 -09:00
add_definitions(-D_LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION=${LIBCXXABI_AVAILABILITY_MINIMUM_HEADER_VERSION})
2020-10-30 09:11:23 -08:00
2014-07-03 11:35:48 -08:00
# Get feature flags.
2017-05-31 16:09:20 -08:00
add_compile_flags_if_supported(-fstrict-aliasing)
2014-07-03 11:35:48 -08:00
2016-05-31 04:01:32 -08:00
# Exceptions
if (LIBCXXABI_ENABLE_EXCEPTIONS)
# Catches C++ exceptions only and tells the compiler to assume that extern C
# functions never throw a C++ exception.
2017-05-31 16:09:20 -08:00
add_compile_flags_if_supported(-EHsc)
# Do we really need to be run through the C compiler ?
add_c_compile_flags_if_supported(-funwind-tables)
2016-05-31 04:01:32 -08:00
else()
2017-05-31 16:09:20 -08:00
add_compile_flags_if_supported(-fno-exceptions)
add_compile_flags_if_supported(-EHs-)
add_compile_flags_if_supported(-EHa-)
2016-05-31 04:01:32 -08:00
endif()
2015-01-22 04:39:08 -09:00
2014-07-03 11:35:48 -08:00
# Assert
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
if (LIBCXXABI_ENABLE_ASSERTIONS)
# MSVC doesn't like _DEBUG on release builds. See PR 4379.
if (NOT MSVC)
2014-11-18 11:37:53 -09:00
list(APPEND LIBCXXABI_COMPILE_FLAGS -D_DEBUG)
2014-07-03 11:35:48 -08:00
endif()
# On Release builds cmake automatically defines NDEBUG, so we
# explicitly undefine it:
if (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
2014-11-18 11:37:53 -09:00
list(APPEND LIBCXXABI_COMPILE_FLAGS -UNDEBUG)
2014-07-03 11:35:48 -08:00
endif()
else()
if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
2014-11-18 11:37:53 -09:00
list(APPEND LIBCXXABI_COMPILE_FLAGS -DNDEBUG)
2014-07-03 11:35:48 -08:00
endif()
endif()
2017-01-03 03:58:34 -09:00
# Threading
2014-11-24 13:42:03 -09:00
if (NOT LIBCXXABI_ENABLE_THREADS)
2016-05-25 09:37:38 -08:00
if (LIBCXXABI_HAS_PTHREAD_API)
message(FATAL_ERROR "LIBCXXABI_HAS_PTHREAD_API can only"
" be set to ON when LIBCXXABI_ENABLE_THREADS"
" is also set to ON.")
endif()
2021-03-05 05:30:13 -09:00
if (LIBCXXABI_HAS_WIN32_THREAD_API)
message(FATAL_ERROR "LIBCXXABI_HAS_WIN32_THREAD_API can only"
" be set to ON when LIBCXXABI_ENABLE_THREADS"
" is also set to ON.")
endif()
2017-01-03 03:58:34 -09:00
if (LIBCXXABI_HAS_EXTERNAL_THREAD_API)
message(FATAL_ERROR "LIBCXXABI_HAS_EXTERNAL_THREAD_API can only"
" be set to ON when LIBCXXABI_ENABLE_THREADS"
" is also set to ON.")
endif()
2016-09-21 01:09:32 -08:00
add_definitions(-D_LIBCXXABI_HAS_NO_THREADS)
2014-11-24 13:42:03 -09:00
endif()
2017-01-09 02:57:21 -09:00
if (LIBCXXABI_HAS_EXTERNAL_THREAD_API)
if (LIBCXXABI_HAS_PTHREAD_API)
message(FATAL_ERROR "The options LIBCXXABI_HAS_EXTERNAL_THREAD_API"
" and LIBCXXABI_HAS_PTHREAD_API cannot be both"
" set to ON at the same time.")
endif()
2021-03-05 05:30:13 -09:00
if (LIBCXXABI_HAS_WIN32_THREAD_API)
message(FATAL_ERROR "The options LIBCXXABI_HAS_EXTERNAL_THREAD_API"
" and LIBCXXABI_HAS_WIN32_THREAD_API cannot be both"
" set to ON at the same time.")
endif()
2017-01-03 03:58:34 -09:00
endif()
2021-03-05 05:30:13 -09:00
if (LIBCXXABI_HAS_PTHREAD_API)
if (LIBCXXABI_HAS_WIN32_THREAD_API)
message(FATAL_ERROR "The options LIBCXXABI_HAS_PTHREAD_API"
"and LIBCXXABI_HAS_WIN32_THREAD_API cannot be both"
"set to ON at the same time.")
endif()
endif()
2017-07-31 01:35:08 -08:00
if (LLVM_ENABLE_MODULES)
# Ignore that the rest of the modules flags are now unused.
add_compile_flags_if_supported(-Wno-unused-command-line-argument)
add_compile_flags(-fno-modules)
endif()
2017-03-03 17:15:37 -09:00
set(LIBCXXABI_HAS_UNDEFINED_SYMBOLS OFF)
2023-07-04 14:44:00 -08:00
if ((NOT LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS) OR MINGW)
2017-03-03 17:15:37 -09:00
set(LIBCXXABI_HAS_UNDEFINED_SYMBOLS ON)
endif()
2017-03-02 10:34:35 -09:00
if (LIBCXXABI_HAS_UNDEFINED_SYMBOLS)
2017-01-03 03:58:34 -09:00
# Need to allow unresolved symbols if this is to work with shared library builds
if (APPLE)
2017-03-03 17:15:37 -09:00
list(APPEND LIBCXXABI_LINK_FLAGS "-undefined dynamic_lookup")
2017-01-03 03:58:34 -09:00
else()
# Relax this restriction from HandleLLVMOptions
string(REPLACE "-Wl,-z,defs" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
endif()
endif()
2016-05-25 09:37:38 -08:00
if (LIBCXXABI_HAS_PTHREAD_API)
add_definitions(-D_LIBCPP_HAS_THREAD_API_PTHREAD)
endif()
2021-03-05 05:30:13 -09:00
if (LIBCXXABI_HAS_WIN32_THREAD_API)
add_definitions(-D_LIBCPP_HAS_THREAD_API_WIN32)
endif()
2017-01-03 03:58:34 -09:00
if (LIBCXXABI_HAS_EXTERNAL_THREAD_API)
2017-01-09 02:57:21 -09:00
add_definitions(-D_LIBCPP_HAS_THREAD_API_EXTERNAL)
endif()
2014-07-03 11:35:48 -08:00
if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
2017-01-13 10:22:26 -09:00
if (LIBCXXABI_SILENT_TERMINATE)
2017-03-01 02:42:01 -09:00
add_definitions(-DLIBCXXABI_SILENT_TERMINATE)
endif()
2021-01-21 12:27:14 -09:00
if (LIBCXXABI_NON_DEMANGLING_TERMINATE)
add_definitions(-DLIBCXXABI_NON_DEMANGLING_TERMINATE)
endif()
2017-03-01 02:42:01 -09:00
if (LIBCXXABI_BAREMETAL)
add_definitions(-DLIBCXXABI_BAREMETAL)
2017-01-13 10:22:26 -09:00
endif()
2022-03-10 00:47:09 -09:00
if (C_SUPPORTS_COMMENT_LIB_PRAGMA)
2019-12-02 01:49:20 -09:00
if (LIBCXXABI_HAS_PTHREAD_LIB)
add_definitions(-D_LIBCXXABI_LINK_PTHREAD_LIB)
endif()
2019-05-29 20:40:21 -08:00
endif()
2014-11-18 11:37:53 -09:00
string(REPLACE ";" " " LIBCXXABI_CXX_FLAGS "${LIBCXXABI_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBCXXABI_CXX_FLAGS}")
2015-01-22 04:39:08 -09:00
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCXXABI_C_FLAGS}")
2014-07-03 11:35:48 -08:00
2021-11-09 08:44:44 -09:00
# On AIX, avoid picking up VMX extensions(i.e. vec_malloc) which would change
# the default alignment of the allocators here.
2025-08-20 08:45:41 -08:00
if (UNIX AND "${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
2021-11-09 08:44:44 -09:00
add_definitions("-D_XOPEN_SOURCE=700")
endif()
2014-07-03 11:35:48 -08:00
#===============================================================================
# Setup Source Code
#===============================================================================
2015-05-08 08:10:11 -08:00
set(LIBCXXABI_LIBUNWIND_INCLUDES "${LIBCXXABI_LIBUNWIND_INCLUDES}" CACHE PATH
"Specify path to libunwind includes." FORCE)
set(LIBCXXABI_LIBUNWIND_PATH "${LIBCXXABI_LIBUNWIND_PATH}" CACHE PATH
"Specify path to libunwind source." FORCE)
2015-04-29 07:53:03 -08:00
if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM)
2019-05-02 09:29:39 -08:00
find_path(LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL libunwind.h
2015-05-08 08:10:11 -08:00
PATHS ${LIBCXXABI_LIBUNWIND_INCLUDES}
${LIBCXXABI_LIBUNWIND_PATH}/include
${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBUNWIND_INCLUDES}
${LLVM_MAIN_SRC_DIR}/projects/libunwind/include
2016-11-11 10:12:58 -09:00
${LLVM_MAIN_SRC_DIR}/runtimes/libunwind/include
2018-04-04 09:40:59 -08:00
${LLVM_MAIN_SRC_DIR}/../libunwind/include
2015-05-09 13:03:01 -08:00
NO_DEFAULT_PATH
2018-01-22 10:41:05 -09:00
NO_CMAKE_FIND_ROOT_PATH
2015-05-08 08:10:11 -08:00
)
2017-04-04 06:03:54 -08:00
if (LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL STREQUAL "LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL-NOTFOUND")
set(LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL "")
endif()
2023-04-21 08:29:36 -08:00
endif()
2017-04-04 06:03:54 -08:00
2023-04-21 08:29:36 -08:00
if (NOT "${LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL}" STREQUAL "")
include_directories("${LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL}")
2016-08-08 09:59:02 -08:00
endif()
2014-07-03 11:35:48 -08:00
2024-05-28 17:31:01 -08:00
add_custom_target(cxxabi-test-depends
COMMENT "Build dependencies required to run the libc++abi test suite.")
2014-07-03 11:35:48 -08:00
# Add source code. This also contains all of the logic for deciding linker flags
# soname, etc...
2022-02-17 07:19:45 -09:00
add_subdirectory(include)
2014-07-03 11:35:48 -08:00
add_subdirectory(src)
2014-07-09 18:20:11 -08:00
2018-01-18 09:29:36 -09:00
if (LIBCXXABI_INCLUDE_TESTS)
2020-08-24 01:01:05 -08:00
add_subdirectory(test)
add_subdirectory(fuzz)
2014-07-09 18:20:11 -08:00
endif()