[CMake] Correct way to build for 64 bit?

Moreland, Kenneth kmorel at sandia.gov
Thu Feb 1 17:34:40 EST 2007


Are there any plans for a more cross-platform mechanism for building a
64bit build?  Perhaps there could be an option for ADD_LIBRARY and
ADD_EXECUTABLE that told CMake whether to build for 32 bit or 64 bit.

I'm thinking of something equivalent to the STATIC/SHARED flags on
ADD_LIBRARY.  I honestly believe that CMake usage would be far lower if
CMake did not handle all of the platform idiosyncrasies of building
shared libraries.  As 64-bit machines become more common (as they
undoubtedly will), I predict switching between 32- or 64-bit builds will
become just as important.

-Ken

> -----Original Message-----
> From: cmake-bounces+kmorel=sandia.gov at cmake.org [mailto:cmake-
> bounces+kmorel=sandia.gov at cmake.org] On Behalf Of Bill Hoffman
> Sent: Monday, January 29, 2007 11:34 AM
> To: Sean McBride
> Cc: cmake at cmake.org
> Subject: Re: [CMake] Correct way to build for 64 bit?
> 
> 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
> 
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake




More information about the CMake mailing list