From 564f5ca2cc983ef7912e563b15aa659e0981aad9 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Fri, 16 May 2025 14:21:16 -0600 Subject: [PATCH] AK: Propagate -U flag to dependencies when built as a static library We added a weak symbol to AK to support overriding the default assertion handler for test cases. However, on macOS, we need to explicitly mark the possibly-null symbol as 'it's ok for this to be undefined'. When AK is a shared library, the flag can be applied to the link step of the dylib, but when it's a static library, we need to apply it to the executable that links against it. --- AK/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/AK/CMakeLists.txt b/AK/CMakeLists.txt index 6fad9546850..06d1c53072e 100644 --- a/AK/CMakeLists.txt +++ b/AK/CMakeLists.txt @@ -74,5 +74,9 @@ if (WIN32) target_link_libraries(AK PRIVATE clang_rt.builtins-x86_64.lib) target_link_libraries(AK PRIVATE Bcrypt.lib) elseif (APPLE) - target_link_options(AK PRIVATE LINKER:-U,_ak_assertion_handler) + set(ASSERTION_HANDLER_VISIBILITY PRIVATE) + if (NOT BUILD_SHARED_LIBS) + set(ASSERTION_HANDLER_VISIBILITY INTERFACE) + endif() + target_link_options(AK ${ASSERTION_HANDLER_VISIBILITY} LINKER:-U,_ak_assertion_handler) endif()