[libc++abi] Make sure we link in CrashReporterClient.a when it's present

When building the system libc++abi for Apple, we use CrashReporterClient
to provide better crash logs when calling abort(). This is exemplified by
the fact that we test for the presence of <CrashReporterClient.h> in
abort_message.cpp.

However, we must link against CrashReporterClient.a in order to get that
functionality, otherwise we get a linking error.
This commit is contained in:
Louis Dionne 2020-06-02 12:21:01 -04:00
parent 0beddbf2cc
commit 6f6c8a2d96

View File

@ -135,6 +135,17 @@ if ( APPLE )
add_link_flags("-Wl,-rpath,${LIBDIR}")
endif()
endif()
# Make sure we link in CrashReporterClient if we find it -- it's used by
# abort() on Apple platforms when building the system dylib.
find_library(CrashReporterClient NAMES libCrashReporterClient.a
PATHS "${CMAKE_OSX_SYSROOT}/usr/local/lib")
if (CrashReporterClient)
message(STATUS "Linking with CrashReporterClient at ${CrashReporterClient}")
add_library_flags("${CrashReporterClient}")
else()
message(STATUS "Could not find CrashReporterClient, not linking against it")
endif()
endif()
split_list(LIBCXXABI_COMPILE_FLAGS)