[CMake] 32/64 bit flag - solved

pellegrini pellegrini at ill.fr
Mon Dec 9 08:53:11 EST 2013


On 12/9/2013 2:34 PM, Eric Noulard wrote:
> 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.
>
>
Hi Eric,

just put your snippet in a macros and everything worked fine: I could 
"guess" the architecture properly. That's for sure from far the best way
to get rid of my architecture "problem".

thanks a lot

Eric


More information about the CMake mailing list