CMake seems to ignore CMAKE_OSX_DEPLOYMENT_TARGET

The variable CMAKE_OSX_DEPLOYMENT_TARGET must initialized as a cache variable prior to the first project() command in order for the Xcode project generation to be picked up properly:

set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment version")

If not set explicitly as a cache variable the CMAKE_OSX_DEPLOYMENT_TARGET is initialized by the MACOSX_DEPLOYMENT_TARGET environment variable.

The initialization of a cache variable like in the assignment above will also override the value of non-cache variables of the same name in the same scope.

Tags:

C++

Xcode

Cmake