Add -ObjC flag to fix static linking on macOS

This commit is contained in:
Jonny Paton 2018-08-27 11:49:42 +01:00 committed by Lukas Dürrenberger
parent ae0ec9d552
commit d1d788fcb3

View File

@ -229,6 +229,11 @@ sfml_add_library(sfml-window
SOURCES ${SRC} ${PLATFORM_SRC}) SOURCES ${SRC} ${PLATFORM_SRC})
target_link_libraries(sfml-window PUBLIC sfml-system) 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 # find and setup usage for external libraries
if(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OPENBSD) 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") sfml_find_package(X11 INCLUDE "X11_INCLUDE_DIR" LINK "X11_X11_LIB" "X11_Xrandr_LIB")