diff --git a/CMakeLists.txt b/CMakeLists.txt index a78472a7cd..4063020552 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,8 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release") endif() +# This block, particularly the versions used, should be kept in sync with +# samples/minimal/CMakeLists.txt. if(APPLE AND NOT CMAKE_OSX_DEPLOYMENT_TARGET) # If no deployment target has been set default to the minimum supported # OS version (this has to be set before the first project() call) diff --git a/samples/minimal/CMakeLists.txt b/samples/minimal/CMakeLists.txt index 8f64044812..7e1333f4fe 100644 --- a/samples/minimal/CMakeLists.txt +++ b/samples/minimal/CMakeLists.txt @@ -16,6 +16,16 @@ # Declare the minimum required CMake version cmake_minimum_required(VERSION 2.8.12) +if(APPLE AND NOT CMAKE_OSX_DEPLOYMENT_TARGET) + # If no deployment target has been set default to the minimum supported + # OS version (this has to be set before the first project() call) + if(CMAKE_SYSTEM_NAME STREQUAL "iOS") + set(CMAKE_OSX_DEPLOYMENT_TARGET 12.0 CACHE STRING "iOS Deployment Target") + else() + set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10 CACHE STRING "macOS Deployment Target") + endif() +endif() + # Name the project project(minimal)