[CMake] cache behavior of CMAKE_OSX_SYSROOT and CMAKE_OSX_DEPLOYMENT_TARGET variables

Comcast Acct sbfreddie at comcast.net
Thu Dec 20 15:05:58 EST 2012


Hello:
On the same note, are these the proper settings to use on the cmake command line at invocation in order to get cmake to build without Xcode?
Thanks,
Freddie

On Dec 20, 2012, at 11:56 AM, Matthew LeRoy wrote:

> Ahh, well then. I guess that makes sense, heh.
> 
> Currently the if(APPLE)... code is after the project() command, but I could certainly move it to before. I would prefer to specify these settings in my CMakeLists file, and not have to specify them manually at cmake-time. That seems like a perfectly reasonable thing to do... what's the reasoning for having to specify your target SDK manually every time you generate?
> 
> Thanks,
> Matt 
> 
> 
> On Thu, Dec 20, 2012 at 2:43 PM, David Cole <david.cole at kitware.com> wrote:
> 
> 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
> 
> --
> 
> 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



More information about the CMake mailing list