Add -ObjC flag to fix static linking on macOS

Fixes regression introduced in aa3a30c
This commit is contained in:
Chris Thrasher 2022-12-14 22:56:17 -07:00
parent 487c97afaf
commit 8049aa3b75

View File

@ -288,6 +288,12 @@ target_link_libraries(sfml-window PUBLIC SFML::System)
# glad sources # glad sources
target_include_directories(sfml-window SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/glad/include") target_include_directories(sfml-window SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/glad/include")
# When static linking on macOS, we need to add this flag for objective C to work
# https://developer.apple.com/library/archive/qa/qa1490/_index.html
if ((NOT BUILD_SHARED_LIBS) AND SFML_OS_MACOSX)
target_link_libraries(sfml-window PRIVATE -ObjC)
endif()
# Vulkan headers # Vulkan headers
target_include_directories(sfml-window SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/vulkan") target_include_directories(sfml-window SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/vulkan")