[CMake] Configure Mac OS X for 32-bit

Tron Thomas tron.thomas at verizon.net
Sat May 1 21:26:05 EDT 2010


I don't want to set the value to architecture set to i386 when I'm 
building on a PowerPC system.  I also only want a single architecture 
for a debug build and universal binary for release builds.

So, I tried doing this in a section of the CMake script that already 
determined it was building on Mac OS X:

if(CMAKE_SYSTEM_PROCESSOR MATCHES "i386")
     set(OSX_ARCHITECTURES_DEBUG "i386")
endif(CMAKE_SYSTEM_PROCESSOR MATCHES "i386")

However when I go to build a debug target in the project the build 
output indicates that the "-arch x86_64" flag is in use, causing the 
built executable to be 64-bit.

The command:
cmake --help-property OSX_ARCHITECTURES

mentioned something about the CMAKE_OSX_ARCHITECTURES variable, however 
the command:
cmake --help-variable CMAKE_OSX_ARCHITECTURES

complained that CMAKE_OSX_ARCHITECTURES was not a defined variable.

What needs to be applied to get CMake to configure a Snow Leopard system 
as 32-bit?

On 05/01/2010 04:55 PM, Mike Jackson wrote:
> You need to set the CMAKE_OSX_ARCHITECTURES to i386. The default build
> on snow leopard is 64bit where as on leopard it is 32 bit.
>
> -----
> Mike Jackson                      www.bluequartz.net
> Principal Software Engineer       mike.jackson at bluequartz.net
> BlueQuartz Software               Dayton, Ohio
>
>
> On May 1, 2010, at 15:33, Tron Thomas<tron.thomas at verizon.net>  wrote:
>
>    
>> I am writing a cross platform application using CMake that builds on
>> Mac OS X.  I just upgraded to CMake 2.8-1.  When I configure and
>> build my project on my Power Mac G5 system running Mac OS X 10.5.8,
>> the project builds just fine.
>>
>> When I try to configure the project on my MacBook Pro running Mac OS
>> X 10.6.3, I get link errors because the project has been configured
>> to build 64-bit applications and some of the needed libraries and
>> frameworks the project links with are only 32-bit.
>>
>> How can I configure my CMake scripts so that the project will build
>> a 32-bit application on my MacBook Pro?
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
>>      
>    



More information about the CMake mailing list