[CMake] [Insight-developers] 64 bit build detection

Sean McBride sean at rogue-research.com
Wed Jun 17 18:49:52 EDT 2009


On 6/14/09 10:05 PM, Michael Wild said:

>On Mac OS X one shouldn't do this kind of detection during configure  
>step, because as has been mentioned a single file can be compiled  
>multiple times for different architectures during one single compiler  
>invocation. The size of void* and even endianness can change. It is  
>preferable to have a central config.h.in (or similar) containing  
>something like this:
>
>#if defined(__APPLE__)
>#  if defined(__i386__)
>#    undef HAVE_64_BIT
>#    undef HAVE_BIG_ENDIAN
>#  elif defined(__ppc__)
>#    undef HAVE_64_BIT
>#    define HAVE_BIG_ENDIAN
>#  elif defined(__x86_64__)
>#    define HAVE_64_BIT
>#    undef HAVE_BIG_ENDIAN
>#  elif defined(__ppc64__)
>#    define HAVE_64_BIT
>#    define HAVE_BIG_ENDIAN
>#  else
>      // oops
>#    error "Unknown architecture!"
>#  endif
>#else
>#  cmakedefine HAVE_64_BIT
>#  cmakedefine HAVE_BIG_ENDIAN
>#endif

I agree with Hendrik that such things are better done with types like
uin32_t, etc.  The quoted stuff above will fail with OS X running on ARM
(ie iPhone).

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada




More information about the CMake mailing list