[CMake] cache behavior of CMAKE_OSX_SYSROOT and CMAKE_OSX_DEPLOYMENT_TARGET variables

David Cole david.cole at kitware.com
Thu Dec 20 14:42:30 EST 2012


Because you're not using the CACHE keyword with your set calls. And if the
cache is initialized before your call, then you won't override it even if
you do use the CACHE keyword.

Where is your "if(APPLE)" code? If it's after the first project command,
then you should be specifying these things in the cmake-gui or ccmake UI,
or by passing -D args on the cmake command line. They shouldn't be
hard-coded in your CMakeLists file.


HTH,
David




On Thu, Dec 20, 2012 at 2:25 PM, Matthew LeRoy <MLeRoy at minitab.com> wrote:

> 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?
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20121220/f5681d7e/attachment.htm>


More information about the CMake mailing list