From 8049aa3b757ed899dc60d1963fa7dbeef73ace77 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Wed, 14 Dec 2022 22:56:17 -0700 Subject: [PATCH] Add -ObjC flag to fix static linking on macOS Fixes regression introduced in aa3a30c --- src/SFML/Window/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/SFML/Window/CMakeLists.txt b/src/SFML/Window/CMakeLists.txt index 79c30019..65d89c94 100644 --- a/src/SFML/Window/CMakeLists.txt +++ b/src/SFML/Window/CMakeLists.txt @@ -288,6 +288,12 @@ target_link_libraries(sfml-window PUBLIC SFML::System) # glad sources 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 target_include_directories(sfml-window SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/vulkan")