<div dir="ltr">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.<div><br></div><div style>
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.</div>
<div style><br></div><div style><br></div><div style>HTH,</div><div style>David</div><div style><br></div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Dec 20, 2012 at 2:25 PM, Matthew LeRoy <span dir="ltr"><<a href="mailto:MLeRoy@minitab.com" target="_blank">MLeRoy@minitab.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Lately I've been attempting to use the CMAKE_OSX_DEPLOYMENT_TARGET and CMAKE_OSX_SYSROOT<br>
variables to set the corresponding properties on the generated Xcode project, and I'm<br>
trying to understand how these variables behave with respect to the CMake cache. I'm using<br>
CMake 2.8.10.2.<br>
<br>
I'm doing the following in my top-level CMakeLists.txt:<br>
<br>
if(APPLE)<br>
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.7)<br>
set(CMAKE_OSX_SYSROOT macosx10.8)<br>
endif()<br>
<br>
Upon generating with 'cmake -G Xcode ..' and looking in the cache for these variables with<br>
'cat CMakeCache.txt | grep OSX', I see this:<br>
<br>
CMAKE_OSX_ARCHITECTURES:STRING=<br>
CMAKE_OSX_DEPLOYMENT_TARGET:STRING=<br>
CMAKE_OSX_SYSROOT:PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk<br>
<br>
Initially I thought something was broken because neither of the two variables I set in my<br>
script are cached with the values I supplied. Once I open the generated Xcode project in<br>
Xcode, though, I see that the corresponding settings are indeed correct; Deployment target<br>
is set to 10.7 and Base SDK is set to 10.8.<br>
<br>
So, why isn't the cache showing the values that I set in my script, and which are showing<br>
correctly in the generated Xcode project?<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div><br></div>