Skip to content

Commit 046a177

Browse files
authored
[libc++] Improve behavior when using relative path for LIBCXX_ASSERTION_HANDLER_FILE (llvm#100157)
Fixes llvm#80696
1 parent 073c199 commit 046a177

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

libcxx/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,16 @@ if (NOT "${LIBCXX_HARDENING_MODE}" IN_LIST LIBCXX_SUPPORTED_HARDENING_MODES)
7171
"Unsupported hardening mode: '${LIBCXX_HARDENING_MODE}'. Supported values are ${LIBCXX_SUPPORTED_HARDENING_MODES}.")
7272
endif()
7373
set(LIBCXX_ASSERTION_HANDLER_FILE
74-
"${CMAKE_CURRENT_SOURCE_DIR}/vendor/llvm/default_assertion_handler.in"
74+
"vendor/llvm/default_assertion_handler.in"
7575
CACHE STRING
7676
"Specify the path to a header that contains a custom implementation of the
7777
assertion handler that gets invoked when a hardening assertion fails. If
7878
provided, this header will be included by the library, replacing the
79-
default assertion handler.")
79+
default assertion handler. If this is specified as a relative path, it
80+
is assumed to be relative to '<monorepo>/libcxx'.")
81+
if (NOT IS_ABSOLUTE "${LIBCXX_ASSERTION_HANDLER_FILE}")
82+
set(LIBCXX_ASSERTION_HANDLER_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${LIBCXX_ASSERTION_HANDLER_FILE}")
83+
endif()
8084
option(LIBCXX_ENABLE_RANDOM_DEVICE
8185
"Whether to include support for std::random_device in the library. Disabling
8286
this can be useful when building the library for platforms that don't have

libcxx/docs/BuildingLibcxx.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,8 @@ libc++ Feature Options
406406
Specify the path to a header that contains a custom implementation of the
407407
assertion handler that gets invoked when a hardening assertion fails. If
408408
provided, this header will be included by the library, replacing the
409-
default assertion handler.
409+
default assertion handler. If this is specified as a relative path, it
410+
is assumed to be relative to ``<monorepo>/libcxx``.
410411

411412

412413
libc++ ABI Feature Options

0 commit comments

Comments
 (0)