[CMake] Configure Mac OS X for 32-bit

Tron Thomas tron.thomas at verizon.net
Sun May 2 17:39:12 EDT 2010


Hello Werner,
It is not just a simple matter of setting the architectures to either 
i386 or ppc.  For debug, the project should create an architecture 
specific build.  For release, the project should build an universal binary.
The help documentation for CMake mentions a property call 
OSX_ARCHITECTURES_DEBUG which sounds like it should do the trick for 
setting the architectures needed for a debug build.  I have tried using 
this property and it doesn't work for me.  I wonder if there might be 
some bugs in CMake around setting the proper architectures for different 
build types on Mac OS X.

I could trying using the -m32 compiler option and see how that works.  I 
would just expect there should be a more direct way to solve this 
problem.  I'm also concerned that applying the option might cause an 
error.  I believe that CMake is going to configure the project to use 
the -arch x86_64 flag, and I'm not sure how well things will work if the 
-arch x86_64 is used with the -m32 flag.

> Hi Thomas,
>
> On 5/2/10 5:41 PM, Tron Thomas wrote:
>    
>> Before when I was using an earlier version of CMake, it would configure
>> the project to build a 32-bit version of all the project target's
>> regardless of which version of Mac OS X I was using.  It would also
>> build just the platform specific version of the targets for a debug build.
>>
>> Now that I have upgraded to CMake version 2.8.1, CMake wants to
>> configure the project's targets to build for 64-bit on Mac OS X 10.6.
>>
>> The only way I've found so far to make Mac OS X 10.6 build 32-bit, is to
>> modify the CMAKE_OSX_ARCHITECTURES to include i386.  However, if I set
>> CMAKE_OSX_ARCHITECTURES to only i386, then it will build create an Intel
>> version of all targets when I build on a PowerPC system.  That means I
>> won't be able to run and test the targets on that platform.
>>
>> I'm trying to get things back to where they were before I upgraded to
>> CMake 2.8.1.  I want it to configure Xcode to build 32-bit targets, with
>> architecture specific version for debug builds.
>>
>> How can someone accomplish this?
>>      
> why not set this option when you call cmake? so:
>
> cmake -DCMAKE_OSX_ARCHITECTURES=386 path-to-source
>
> on your 10.6 system and
>
> cmake -DCMAKE_OSX_ARCHITECTURES=ppc path-to-source
>
> on your old system (that is, if you use the command line cmake).
>
> Alternatively you could add the -m32 option to gcc like this
>
> export CC="gcc -m32"
> cmake path-to-source
>
> on your 10.6 system where a 32 bit application should then be build
> (according e.g.
> http://www.cyberciti.biz/tips/compile-32bit-application-using-gcc-64-bit-linux.html
> , which should also be true for Mac OS X 10.6).
>
> Regards,
> Werner
>
>    


More information about the CMake mailing list