[CMake] Fwd: 64 bit flags

Eric Noulard eric.noulard at gmail.com
Fri Sep 9 07:43:06 EDT 2011


I did forget the ML.


---------- Forwarded message ----------
From: Eric Noulard <eric.noulard at gmail.com>
Date: 2011/9/9
Subject: Re: [CMake] 64 bit flags
To: pellegrini <pellegrini at ill.fr>


2011/9/9 pellegrini <pellegrini at ill.fr>:
> Hello everybody,
>
> I have a Fortran project that is currently built (using gfortran, g95 or
> ifort) on 32 bits machines but that might need quite soon to be built on 64
> bit machines as well.
>
> Does cmake automatically detect the processor architecture and add the 64
> bit flag at configuration time or do I have to declare those flags through,
> for example, a '-D option ?

CMake chose the default target architecture of your compiler so
if the default target ofthe compiler is 64bits no need for special flags.

To be more clear:

  If I compile some code on a 32bits host the compiler
  (C, Fortran or whatever) usually produce 32bits binaries

  If I compile some code on a 64 bits host the compiler
  (C, Fortran or whatever) usually produce 64bits binaries

So CMake detect the compiler (C; Fortran, ...) and do not care
about 32/64 bits issue.

Now if YOUR code as 32/64 bits specific zone then you need an appropriate
macro whose definition may be done by you (in CMakeLists.txt) by testing
the value of CMAKE_SIZEOF_VOID_P.

Now some platform like Mac OS support multi-arch binaries and if you
crawl the mail archive you'll find discussion about that.


--
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org



-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list