Skip to content

Commit

Permalink
Require CMake 3.16 for ObjC and ObjC++ sources
Browse files Browse the repository at this point in the history
Both languages gained native CMake support in 3.16:
https://cmake.org/cmake/help/latest/release/3.16.html#languages
  • Loading branch information
friendlyanon authored and eXpl0it3r committed Aug 3, 2022
1 parent a47eb83 commit e691033
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 2 additions & 0 deletions examples/cocoa/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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})
Expand Down
1 change: 1 addition & 0 deletions src/SFML/Main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 2 additions & 5 deletions src/SFML/Window/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")

Expand Down

0 comments on commit e691033

Please sign in to comment.