Require CMake 3.16 for ObjC and ObjC++ sources

Both languages gained native CMake support in 3.16:
https://cmake.org/cmake/help/latest/release/3.16.html#languages
This commit is contained in:
friendlyanon 2022-08-01 22:13:11 +02:00
parent a47eb8320a
commit aa3a30cc35
4 changed files with 6 additions and 6 deletions

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.15) cmake_minimum_required(VERSION 3.16)
# define a macro that helps defining an option # define a macro that helps defining an option
macro(sfml_set_option var default type docstring) macro(sfml_set_option var default type docstring)

View File

@ -1,3 +1,5 @@
enable_language(OBJC OBJCXX)
# Usage: compile_xib(INPUT path/to/file.xib OUTPUT path/to/file.nib) # Usage: compile_xib(INPUT path/to/file.xib OUTPUT path/to/file.nib)
function(compile_xib) function(compile_xib)
cmake_parse_arguments(THIS "" "INPUT;OUTPUT" "" ${ARGN}) cmake_parse_arguments(THIS "" "INPUT;OUTPUT" "" ${ARGN})

View File

@ -6,6 +6,7 @@ set(SRCROOT ${PROJECT_SOURCE_DIR}/src/SFML/Main)
if(SFML_OS_WINDOWS) if(SFML_OS_WINDOWS)
set(SRC ${SRC} ${SRCROOT}/MainWin32.cpp) set(SRC ${SRC} ${SRCROOT}/MainWin32.cpp)
elseif(SFML_OS_IOS) elseif(SFML_OS_IOS)
enable_language(OBJCXX)
set(SRC ${SRC} ${SRCROOT}/MainiOS.mm) set(SRC ${SRC} ${SRCROOT}/MainiOS.mm)
elseif(SFML_OS_ANDROID) elseif(SFML_OS_ANDROID)
set(SRC ${SRC} ${SRCROOT}/MainAndroid.cpp) set(SRC ${SRC} ${SRCROOT}/MainAndroid.cpp)

View File

@ -150,6 +150,7 @@ elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD)
endif() endif()
source_group("unix" FILES ${PLATFORM_SRC}) source_group("unix" FILES ${PLATFORM_SRC})
elseif(SFML_OS_MACOSX) elseif(SFML_OS_MACOSX)
enable_language(OBJC OBJCXX)
set(PLATFORM_SRC set(PLATFORM_SRC
${SRCROOT}/OSX/cpp_objc_conversion.h ${SRCROOT}/OSX/cpp_objc_conversion.h
${SRCROOT}/OSX/cpp_objc_conversion.mm ${SRCROOT}/OSX/cpp_objc_conversion.mm
@ -203,6 +204,7 @@ elseif(SFML_OS_MACOSX)
) )
source_group("mac" FILES ${PLATFORM_SRC}) source_group("mac" FILES ${PLATFORM_SRC})
elseif(SFML_OS_IOS) elseif(SFML_OS_IOS)
enable_language(OBJCXX)
set(PLATFORM_SRC set(PLATFORM_SRC
${SRCROOT}/iOS/CursorImpl.hpp ${SRCROOT}/iOS/CursorImpl.hpp
${SRCROOT}/iOS/CursorImpl.cpp ${SRCROOT}/iOS/CursorImpl.cpp
@ -272,11 +274,6 @@ 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
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")