[CMake] cache behavior of CMAKE_OSX_SYSROOT and CMAKE_OSX_DEPLOYMENT_TARGET variables

Matthew LeRoy MLeRoy at minitab.com
Thu Dec 20 14:25:28 EST 2012


Hi,

Lately I've been attempting to use the CMAKE_OSX_DEPLOYMENT_TARGET and CMAKE_OSX_SYSROOT
variables to set the corresponding properties on the generated Xcode project, and I'm
trying to understand how these variables behave with respect to the CMake cache. I'm using
CMake 2.8.10.2.

I'm doing the following in my top-level CMakeLists.txt:

  if(APPLE)
    set(CMAKE_OSX_DEPLOYMENT_TARGET 10.7)
    set(CMAKE_OSX_SYSROOT macosx10.8)
  endif()

Upon generating with 'cmake -G Xcode ..' and looking in the cache for these variables with
'cat CMakeCache.txt | grep OSX', I see this:

  CMAKE_OSX_ARCHITECTURES:STRING=
  CMAKE_OSX_DEPLOYMENT_TARGET:STRING=
  CMAKE_OSX_SYSROOT:PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk

Initially I thought something was broken because neither of the two variables I set in my
script are cached with the values I supplied. Once I open the generated Xcode project in
Xcode, though, I see that the corresponding settings are indeed correct; Deployment target
is set to 10.7 and Base SDK is set to 10.8.

So, why isn't the cache showing the values that I set in my script, and which are showing
correctly in the generated Xcode project?


More information about the CMake mailing list