[CMake] Linking against OS X Frameworks

Michael Wild themiwi at gmail.com
Tue Aug 11 00:21:06 EDT 2009


On 11. Aug, 2009, at 4:56, ML wrote:

> All,
>
>>>>>> What is the command to force 32-bit carbon as now that I set  
>>>>>> 10.4 as my
>>>>>> SDK and I am running on a 64 -bit machine I am getting errors  
>>>>>> like:
>>>>>>
>>>>>> In file included from /Volumes/Data/jtsm/Checkout/Universal
>>>>>> GUI/source/thirdparty/OSX/MoreFilesX/MoreFilesX.c:80:
>>>>>>
>>>>>> /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/ 
>>>>>> Carbon.framework/Headers/Carbon.h:20:6:
>>>>>> error: #error 64-bit not supported
>>>>
>>>>> Just set CMAKE_OSX_ARCHITECTURES to i368, ppc or if you want a  
>>>>> universal
>>>>> binary, "i368;ppc"
>>>>
>>>> I have:
>>>>
>>>> SET (CMAKE_OSX_SYSROOT=/Developer/SDKs/MacOSX10.4u.sdk)
>>>> SET (CMAKE_OSX_DEPLOYMENT_TARGET=10.4)
>>>> SET (CMAKE_OSX_ARCHITECTURES="i368;ppc")
>>>
>>> And, yes for clarity i did change the above from Michael to say:
>>>
>>> SET (CMAKE_OSX_SYSROOT=/Developer/SDKs/MacOSX10.4u.sdk)
>>> SET (CMAKE_OSX_DEPLOYMENT_TARGET=10.4)
>>> SET (CMAKE_OSX_ARCHITECTURES="i386;ppc")
>>>
>>> [CMAKE_OSX_ARCHITECTURES was wrong.]

Don't set them in the CMakeLists.txt. Set them in the CACHE! That is,  
either using ccmake, cmake-gui or the -D flag for the cmake  
executable. You can also use an initial cache, as described in the  
cmake.1 man-page.

>
>> What version of CMake are you using?
>
>
> [jtsm at Jason-T-Slack-Moehrles-MacBook-Pro ~/Checkout/Universal GUI]$  
> cmake -version
> cmake version 2.6-patch 4
>
>> I'm not sure if the
>> CMAKE_OSX_DEPLOYMENT_TARGET was included in the CMake 2.6 branch.
>
> Yeah, I dont see it here: http://cmake.org/cmake/help/ 
> cmake2.6docs.html


In the code I posted, I emulate the behaviour of  
CMAKE_OSX_DEPLOYMENT_TARGET in older versions of cmake. Proper support  
for this variable will probably appear in 2.8.

>
>> You may also have to set these BEFORE the first time you ever run
>> CMake in your build directory.
>
> Well  for my CMakeLists.txt I set them almost off the bat.
>
> Are you thinking environment variables and run cmake form a shell  
> script of something?

There are several ways. Again, refer to the man-page. But Probably the  
most convenient way for you is using the -C flag:

http://cmake.org/cmake/help/cmake2.6docs.html#opt:-Cinitial-cache

>
> I suppose I can check out the latest development branch from CVS and  
> see what happens with that.
>
> -Jason


Michael


More information about the CMake mailing list