[CMake] OSX universal binary support

Mike Jackson imikejackson at gmail.com
Tue Jan 15 09:59:42 EST 2008


On Jan 15, 2008, at 8:44 AM, Bill Hoffman wrote:

> Mike Jackson wrote:
>> There is and there is not.
>> What you need to try is putting -arch ppc -arch i386 for both the  
>> CXX_FLAGS and C_FLAGS using ccmake.
>> That works for me in 10.4.11 with gcc.
>
> Actually, there is full support for universal binaries in CMake.
> If you set this cmake cache variable:
>   CMAKE_OSX_ARCHITECTURES=ppc;i386
>
> Or set the same name environment variable before running CMake, the  
> makefiles or Xcode will produce OSX universal binaries.
>
> -Bill


Funny.. last time I asked I was told to use "i386 ppc" which did not  
work and so I started adding the flags myself. Using a ";" instead of  
a space does allow universal binaries to be produced.

Of course one has to be careful when doing this with endian specific  
code. Have both PPC and i386 is basically cross compiling and trying  
to determine the proper byte ordering of the target machine is prone  
to errors. Just FYI for those with this type of code.

Thanks for the correction Bill.

-- 
Mike Jackson   Senior Research Engineer
Innovative Management & Technology Services




More information about the CMake mailing list