[CMake] Linking against OS X Frameworks
Michael Wild
themiwi at gmail.com
Sun Aug 9 15:07:03 EDT 2009
On 9. Aug, 2009, at 18:59, ML wrote:
> Michael,
>
> Thank you for this example! It was really informative. Definitely a
> missing piece in my knowledge thus far.
>
> One question:
>
> I get an error stating:
>
> CMake Error at CMakeLists.txt:70 (message):
> MoreFilesX requires the SDK version to be not newer than 10.4u (10.6
> detected)
>
> this comes from here:
>
>> # figure out Mac OSX SDK version (do not care for the u-suffix in
>> 10.4u)
>> get_filename_component( SDK_VER ${CMAKE_OSX_SYSROOT} NAME )
>> string( REPLACE ".sdk" "" SDK_VER ${SDK_VER} )
>> string( REPLACE "MacOSX" "" SDK_VER ${SDK_VER} )
>> string( REGEX REPLACE "[a-zA-Z]" "" SDK_VER ${SDK_VER} )
>> # this REALLY needs the 10.4 SDK.
>> if( ${SDK_VER} VERSION_GREATER 10.4 )
>> message( SEND_ERROR "MoreFilesX requires the SDK version to be not
>> newer than 10.4u (${SDK_VER} detected)" )
>> endif( ${SDK_VER} VERSION_GREATER 10.4 )
>
> So how do I turn around and set 10.4u if it is not automatically
> detected?
>
> It is like this:
>
> CMAKE_OSX_SYSROOT=/Developer/SDKs/MacOSX10.4u.sdk
>
> Best,
>
> -Jason
>
CMake by default detects the most current SDK. If you want to use a
different one, you have to set it in the cache, by e.g. executing
cmake -DCMAKE_OSX_SYSROOT=/Developer/SDKs/MacOSX10.4u.sdk -
DCMAKE_OSX_DEPLOYMENT_TARGET=10.4 .
in the build tree. Above command also sets
CMAKE_OSX_DEPLOYMENT_TARGET=10.4 for consistency.
Please note that it is supported (and meaningful) to have different
versions of the SDK and the deployment target (both of them may be
newer than the other, so "all combinations allowed"). However, this
has implications on compiling, linking and loading, which I can't
remember just off the top of my head.
Michael
More information about the CMake
mailing list