[CMake] [MacOSX] How to compile for certain SDK?

Michael Jackson mike.jackson at bluequartz.net
Mon Jul 20 09:41:49 EDT 2009



On Jul 20, 2009, at 7:44 AM, Michael Wild wrote:

>
> On 20. Jul, 2009, at 13:22, Steven Van Ingelgem wrote:
>
>> Hi,
>>
>>
>> I checked and in Darwin.cmake there are several items like
>> "CMAKE_OSX_ARCHITECTURES_DEFAULT" and
>> "CMAKE_OSX_DEPLOYMENT_TARGET_DEFAULT"... But...
>> I can't set them properly in my own CMakeLists.txt file. As such,  
>> when I set
>> the minimum version to 10.4, it still will try to compile against  
>> v10.5 of
>> the SDK...
>>
>> Is there a way to set all of this properly or do I need to fiddle  
>> with the
>> C/CXX make flags (bah)?
>>
>>
>> Thanks,
>> Steven
>
> The variables are CMAKE_OSX_ARCHITECTURES,  
> CMAKE_OSX_DEPLOYMENT_TARGET and CMAKE_OSX_SYSROOT. The ones you  
> mentioned are the defaults to pre-populate the cache and get  
> assigned to the variables I mentioned before you have any chance of  
> changing them.
>
> However, I strongly advice NOT to set them in your CMakeLists.txt,  
> unless it really is required. Let the user set those variables in  
> the cache.
>
> Michael


I Would also add that by setting the SDK Root to 10.4 you are  
basically saying that your code ONLY runs on 10.4 and NOT 10.5. Is  
that really what you want?

http://public.kitware.com/Bug/view.php?id=6195   has a good history  
and proper usage of those variables.

If you _really_ wand to set those then you will probably have use the  
long form of the "set()" command with the keyword "FORCE" but I  
encourage you to read through the bug report to figure out if this is  
truly what you want.

Mike Jackson



More information about the CMake mailing list