[Insight-developers] 64 bit build detection
Bill Hoffman
bill.hoffman at kitware.com
Thu Jun 11 14:06:49 EDT 2009
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
More information about the Insight-developers
mailing list