diff --git a/CMakeLists.txt b/CMakeLists.txt index 62a0955b..346a5c96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.15) +cmake_minimum_required(VERSION 3.16) # define a macro that helps defining an option macro(sfml_set_option var default type docstring) diff --git a/examples/cocoa/CMakeLists.txt b/examples/cocoa/CMakeLists.txt index 731ac518..30819faa 100644 --- a/examples/cocoa/CMakeLists.txt +++ b/examples/cocoa/CMakeLists.txt @@ -1,3 +1,5 @@ +enable_language(OBJC OBJCXX) + # Usage: compile_xib(INPUT path/to/file.xib OUTPUT path/to/file.nib) function(compile_xib) cmake_parse_arguments(THIS "" "INPUT;OUTPUT" "" ${ARGN}) diff --git a/src/SFML/Main/CMakeLists.txt b/src/SFML/Main/CMakeLists.txt index f889768a..3cd14048 100644 --- a/src/SFML/Main/CMakeLists.txt +++ b/src/SFML/Main/CMakeLists.txt @@ -6,6 +6,7 @@ set(SRCROOT ${PROJECT_SOURCE_DIR}/src/SFML/Main) if(SFML_OS_WINDOWS) set(SRC ${SRC} ${SRCROOT}/MainWin32.cpp) elseif(SFML_OS_IOS) + enable_language(OBJCXX) set(SRC ${SRC} ${SRCROOT}/MainiOS.mm) elseif(SFML_OS_ANDROID) set(SRC ${SRC} ${SRCROOT}/MainAndroid.cpp) diff --git a/src/SFML/Window/CMakeLists.txt b/src/SFML/Window/CMakeLists.txt index d2afd093..c9595b3e 100644 --- a/src/SFML/Window/CMakeLists.txt +++ b/src/SFML/Window/CMakeLists.txt @@ -150,6 +150,7 @@ elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD) endif() source_group("unix" FILES ${PLATFORM_SRC}) elseif(SFML_OS_MACOSX) + enable_language(OBJC OBJCXX) set(PLATFORM_SRC ${SRCROOT}/OSX/cpp_objc_conversion.h ${SRCROOT}/OSX/cpp_objc_conversion.mm @@ -203,6 +204,7 @@ elseif(SFML_OS_MACOSX) ) source_group("mac" FILES ${PLATFORM_SRC}) elseif(SFML_OS_IOS) + enable_language(OBJCXX) set(PLATFORM_SRC ${SRCROOT}/iOS/CursorImpl.hpp ${SRCROOT}/iOS/CursorImpl.cpp @@ -272,11 +274,6 @@ 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 -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")