[CMake] Correct way to build for 64 bit?

Bill Hoffman bill.hoffman at kitware.com
Mon Jan 29 13:33:33 EST 2007


Sean McBride wrote:
> Hi all,
>
> What is the correct way to build a project as a 64 bit executable?
>
> When I build something on my PowerMac G5 (ex CMake or VTK), it is built
> as a 32 bit executable.  The G5 is a 64 bit processor, but both gcc and
> CMake default to doing 32 bit builds (quite reasonable IMHO).
>
> The 'Mac way' would be to pass '-arch ppc64' to gcc.  What is the CMake
> way?  Should I set CMAKE_OSX_ARCHITECTURES to ppc64?  Or am I expected
> to specify '-arch ppc64' myself somewhere?
>
> Thanks!
>
>   
Currently, you will have to set CFLAGS and CXXFLAGS to -arch ppc64, also 
most likely LDFLAGS.  Set those in the environment before running cmake. 
That is what we do on other 64 bit platforms (IRIX for example).  At 
some point I will get around to your bug report and have 
CMAKE_OSX_ARCHITECTURES handle having just one thing like ppc64.  (you 
are welcome of course to provide a patch for that...  :-) ) .

-Bill



More information about the CMake mailing list