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

Michael Jackson mike.jackson at bluequartz.net
Thu Jun 11 14:10:14 EDT 2009


And what if you are on a system like OS X where the default build is  
32 bit but you can have a 64 bit binary built? Then  
CMAKE_SIZEOF_VOID_P is going to be invalid.


---
Mike Jackson                 www.bluequartz.net



On Jun 11, 2009, at 2:06 PM, Bill Hoffman wrote:

> kent williams wrote:
>> Interesting question. Looking at what we do (and that's based on  
>> what Slicer
>> does) the difference between 64 and 32 bit comes about in how we  
>> set the
>> CFLAGS and CXXFLAGS before we run CMake -- we don't tell CMake  
>> anything
>> about whether it's 32 or 64 bit.
>> I don't remember seeing anything about CMake telling you whether  
>> you're 32
>> or 64bit. As a last ditch effort you could try to run a program  
>> that uses
>> the current CFLAGS and returns the size of a pointer e.g.
>> int main() { exit(sizeof(void *) == 4 ? 32 : 64 ); }
>
> CMake always does a try compile and sets CMAKE_SIZEOF_VOID_P in any  
> CMake based project.  If that is 8 you are 64 bit.
>
> -Bill
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list