[CMake] 32/64 bit flag

Eric Noulard eric.noulard at gmail.com
Mon Dec 9 08:34:08 EST 2013


2013/12/9 pellegrini <pellegrini at ill.fr>:

>>
>>
> Thanks Eric for the hint.
> I read some time ago some stuffs about the CMAKE_SIZEOF_VOID_P variable but
> unfortunately, in the present case,
> the problem is a bit different. It can be for example that on a 64 bit
> machine, I would like to use the 32 bit
> ifort version because the only version of Winteracter library I have is the
> 32 bit one. That's why I came to the point
> that the only way to proceed was through a cmake option. I could also try to
> guess the kind of build I would like from
> the path of my compiler but this approach seems quite restrictive and
> especially hazardous ...

This shouldn't be true.

the value of CMAKE_SIZEOF_VOID_P should follow the capacity of the
**compiler** used and not the capacity of the host.
It works for cross-compiling as well.

e.g. when I cross compile to Win32 on my Linux 64 bits host
CMAKE_SIZEOF_VOID_P is equal to 4 i.e. 32 bits.

In your case you are on 64 bit Windows host but you compile
your program using a 32 bits compiler, this should work.

The easiest way to check what happen is to try to print the value
of CMAKE_SIZEOF_VOID_P in yor case.


-- 
Erk
L'élection n'est pas la démocratie -- http://www.le-message.org


More information about the CMake mailing list