[CMake] 64bit programming

Matthew Woehlke mw_triad at users.sourceforge.net
Fri Aug 22 20:34:35 EDT 2008


Darren Weber wrote:
> What are the traps and tricks for 64bit programming with CMake and other
> kitware libraries?

Don't make assumptions about sizeof(long) or sizeof(void*)... not even 
that they are the same (Microsoft, in their infinite wisdom, decided - 
as usual - to be different from everyone else and adopt a P64 model, 
rather than LP64 used by *everyone* else). That's the big thing. I don't 
know about kitware libraries, but I wouldn't expect much in the way of 
"gotchas" regarding 64-bit builds and cmake... at least, not on 
non-Windows platforms :-).

> What is the easiest way to create source trees that will compile for 32bit
> or 64bit applications?  Can it be as simple as ifdefs in one or two headers?

Depending on what you need to do, it can be as simple as... not doing 
anything! Well, more to the point, if your code is well-written (no 
assumptions about pointer size, etc), it's possible to have very little 
conditional code, or even none at all (in your own source anyway; the 
system headers might be another matter, but obviously you won't be 
editing those).

-- 
Matthew
For great justice!! -- Captain (Zero Wing)



More information about the CMake mailing list