[cmake-developers] CMAKE_SYSROOT vs CMAKE_OSX_SYSROOT

Brad King brad.king at kitware.com
Fri Jul 19 08:32:47 EDT 2013


On 07/19/2013 12:02 AM, clinton at elemtech.com wrote:
> ----- Original Message -----
>> It looks to me like CMAKE_SYSROOT and CMAKE_OSX_SYSROOT are
>> pretty much identical other than the logical name mapping.
>> At a minimum we need to make them mutually exclusive (at most
>> one can be set in a single build tree).  Ideally we should
>> combine them so that one only needs to set CMAKE_SYSROOT on
>> any platform.
>>
>> Combining them is safe only if we're sure CMAKE_SYSROOT will
>> not be used for anything besides the toolchain system SDK.
>>
> 
> I'm seeing slight hints that we should not merge them.
> 
> $ xcrun --help
>   ...
>   --sdk <sdk name>     find the tool for the given SDK name

This one is for the value passed to the -isysroot flag.

>   --toolchain <name>   find the tool for the given toolchain

This one is for selecting the compiler tool (cc) location.

> I currently have SDKs are under /Applications/Xcode.app/Contents/Developer/Platform
>  - 10.7, 10.8, iPhoneOS6.1, iPhoneSimulator6.1
> 
> and toolchains found under /Applications/Xcode.app/Contents/Developer/Toolchains
>  - XcodeDefault.xctoolchain (clang)

By "toolchain system SDK" I meant "point the toolchain at the
SDK for the target system".  Regardless of how many SDKs are
available or how they are organized one still chooses exactly
one of them to pass as -isysroot on OS X.  That is what
CMAKE_OSX_SYSROOT does.  The proposed CMAKE_SYSROOT generates
the --sysroot flag on Linux and perhaps other platforms.  They
seem the same to me on the respective platforms.

-Brad



More information about the cmake-developers mailing list