set(CMAKE_SYSTEM_NAME "iOS") set(IOS TRUE) # https://gitlab.kitware.com/cmake/cmake/-/issues/19655 set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH) set(SDK_TO_USE iphonesimulator) set(CMAKE_OSX_ARCHITECTURES x86_64 CACHE STRING "OSX Architectures") set(CMAKE_OSX_DEPLOYMENT_TARGET 12.0 CACHE STRING "OSX Deployment target") if(NOT "${CMAKE_GENERATOR}" MATCHES "Xcode") message(FATAL_ERROR "Only Xcode as generator for iOS builds supported") endif() execute_process(COMMAND xcodebuild -version -sdk ${SDK_TO_USE} Path OUTPUT_VARIABLE CMAKE_OSX_SYSROOT ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE ) if(NOT DEFINED CMAKE_OSX_SYSROOT) message(FATAL_ERROR "Please make sure Xcode is installed") endif()