On May 3, 2010, at 10:11 AM, Sean McBride wrote:

> On Mon, 3 May 2010 09:59:36 -0600, Karl Merkley said:
> 
>> I just read through this entire thread and I would like to expand it a
>> little.   Regardless of platform, what is the right way to determine the
>> right build architecture?  I run on a 32 bit Linux box but I use distcc
>> which distributes the build to some 64 bit machines.    I always just
>> edit the CMakeCache.txt manually and add the -m32 flag.    Some of my
>> customers don't like that approach and would like to automate the
>> decision for Mac, Linux and Windows.    So I need to determine whether the
>> platform that cmake runs on is 32 bit or 64 bit and then set the correct
>> flags for that platform.
> 
> For Mac anyway, the 32/64 'bitness' of the building machine is
> irrelevant.  PPC Macs can build Intel code, 32 bit Macs can build 64 bit
> code, and vice versa, and etc.
> 
> Your code needs to be written such that it 1) supports both endiannesses
> 2) understands both 32 and 64 bit pointers 3) doesn't make invalid
> assumptions about the size of int, long, void*, etc.  Only if your code
> is properly written can it be built as either 32 or 64 bit.  Then I
> guess the person doing the building also has to decide which kinds of
> machines he's building for.


The code currently builds and runs in 32 or 64 bit on Linux, Mac and Windows.   
What I would like to be able to do is to detect the build environment that the 
user starts cmake in and configure correctly for that environment.   For 
example,  if I am building on my 32-bit Linux box I want to detect that gcc 
needs the -m32 flag and have that added automatically to my build process 
without having the user specify the architecture.    I'm not looking at 
supporting cross-platform builds on one system, I just want to build correctly 
on the system that the user starts the build on without any further user 
intervention.    It should work the same way if I am on my older Intel MacBook 
or a 64-bit Windows system.

 -- Karl


_______________________________________________
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

Reply via email to