[libc++] Improve diagnostic for libcxxabi missing from the runtimes (#208274)

When libc++ is configured to use libc++abi as an ABI library but
libcxxabi is not part of the runtimes, we'd end up with a confusing
build error about a missing <cxxabi.h> header. Instead, diagnose at
CMake configuration time.

Closes #136480
This commit is contained in:
Louis Dionne authored and GitHub committed 2026-07-14 07:59:40 -04:00
1 parent 6e515cd098
commit 98c4ea46bd
1 file changed
+7
@@ -148,6 +148,13 @@ elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libcxxabi")
add_library(libcxx-abi-static-objects ALIAS cxxabi_static_objects)
endif()
if (NOT TARGET cxxabi_static AND NOT TARGET cxxabi_shared
AND NOT TARGET cxxabi_static_objects AND NOT TARGET cxxabi_shared_objects)
message(FATAL_ERROR "Can't find any libc++abi target but LIBCXX_CXX_ABI is set to libcxxabi, "
"did you forget to include libcxxabi in LLVM_ENABLE_RUNTIMES, or did you "
"intend to use LIBCXX_CXX_ABI=system-libcxxabi instead?")
endif()
# Link against a system-provided libc++abi
elseif ("${LIBCXX_CXX_ABI}" STREQUAL "system-libcxxabi")
if(NOT LIBCXX_CXX_ABI_INCLUDE_PATHS)