[CMake] Configure Mac OS X for 32-bit

Tron Thomas tron.thomas at verizon.net
Mon May 3 11:11:29 EDT 2010


What is the purpose for the OSX_ARCHITECTURE and 
OSX_ARCHITECTURES_<CONFIG> properties that already exist in CMAKE?  It 
seems like they might be properties that are already meant to address an 
issue like this, only I can't figure out how they work.

Also, I think previous versions of CMake did not have this problem, only 
I'm not certain of that.

On 05/02/2010 11:36 PM, Michael Wild wrote:
> Ahh, you want a release build to be i386 AND ppc and your debug build to be just ppc? Use different binary trees then. Simple as that. If you're not satisfied with that, put a feature request for CMAKE_OSX_ARCHITECTURES_<CONFIG>  in the bug tracker...
>
> Michael
>
> On 2. May, 2010, at 23:39 , Tron Thomas wrote:
>
>    
>> 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
>>>
>>>
>>>        
>> _______________________________________________
>> 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