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

Michael Jackson mike.jackson at bluequartz.net
Thu Jun 11 16:00:03 EDT 2009


529:[mjackson at Ferb:x64]$ export CXXFLAGS="-arch x86_64"
530:[mjackson at Ferb:x64]$ rm -rf *; cmake ../
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- CMAKE_SIZEOF_VOID_P: 8
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/mjackson/Desktop/Test/x64

For those reading this after the fact or from a google search...

So. where does this leave us? Basically if you ONLY do one arch or  
another on OS X using this type of technique is probably fine. If you  
are building Universal binaries then some thing more in-depth would be  
needed if the explicit detection of the size of a void pointer is  
needed. Probably something using the standard apple #ifdef __APPLE__  
&& __LP64 or something like that.

  This may still fall apart if someone wrote a program to spit out  
various stats on the system, the executable was built as a universal  
binary, ran as a 32 bit executable but the user was expecting a 64 bit  
executable to be run. Maybe none of this matters.

At least I figured out that much today. ;-)

mike

On Jun 11, 2009, at 3:37 PM, Bill Hoffman wrote:

> Michael Jackson wrote:
>
>> So it builds a 32 bit executable.
> :)
>> Are you saying (from above) that if I have a 64 bit build of CMake  
>> then I will get 64 bit binaries by default?
> No, it depends on the flags given to the compiler.  I think you want  
> -m64.  So if you do this:
>
> export CFLAGS=-m64
> mkdir Build64
> cd Build64
> cmake ../Test
> make
>
> Then you will get a 64 bit build.
>
> -Bill



More information about the CMake mailing list