[CMake] How can I know the target is 32-bit, or 64bit

Pawel Sikora pluto at agmk.net
Tue Aug 30 03:42:49 EDT 2011


On Tuesday 30 of August 2011 08:40:08 Michael Wild wrote:
> On Tue 30 Aug 2011 07:54:45 AM CEST, Dongsheng Song wrote:
> > Hi,
> > 
> > In CMakeLists.txt, I want to know whether cmake has built-in mechanism that
> > I can know the target is 32-bit, or 64bit ?
> > 
> > Thanks,
> > Dongsheng
> 
> Look at the CMAKE_SIZEOF_VOID_P variable. However, normally this is 
> better handled in the code through #ifdef's, because on some platforms 
> (e.g. Mac) it is possible to compile for multiple architecture at once 
> with a single compiler invocation.

there's also a new x86 target with 64-bit intruction set and 32-bit pointer
called "X32" -> https://sites.google.com/site/x32abi/



More information about the CMake mailing list