diff --git a/src/SFML/Window/CMakeLists.txt b/src/SFML/Window/CMakeLists.txt index 1fe8b5a43..98ea43946 100644 --- a/src/SFML/Window/CMakeLists.txt +++ b/src/SFML/Window/CMakeLists.txt @@ -229,6 +229,11 @@ sfml_add_library(sfml-window SOURCES ${SRC} ${PLATFORM_SRC}) target_link_libraries(sfml-window PUBLIC sfml-system) +# When static linking on macOS, we need to add this flag for objective C to work +if ((NOT BUILD_SHARED_LIBS) AND SFML_OS_MACOSX) + target_link_libraries(sfml-window PRIVATE -ObjC) +endif() + # find and setup usage for external libraries if(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OPENBSD) sfml_find_package(X11 INCLUDE "X11_INCLUDE_DIR" LINK "X11_X11_LIB" "X11_Xrandr_LIB")