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.
This commit is contained in:
Andrew Kaster 2025-05-16 14:21:16 -06:00 committed by Andrew Kaster
commit 564f5ca2cc
Notes: github-actions[bot] 2025-05-16 21:00:38 +00:00

View file

@ -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()