[CMake] OS X architecture changes interfere with CheckTypeSize()?

Erik Lindahl lindahl at cbr.su.se
Wed Aug 11 14:52:32 EDT 2010


Hi Sean,

On Aug 11, 2010, at 8:08 PM, Sean McBride wrote:

> On Wed, 11 Aug 2010 18:08:35 +0200, Erik Lindahl said:
> 
>> All the CheckTypeSize() tests then seem to run directly when e.g. ccmake
>> is invoked, and they thus set all SIZEOF_XXX defines to the 64-bit
>> values (e.g. 8 for "long int").
> 
> Why do you need to know the size of 'long'?  Its size is not guaranteed
> by the language spec.  If you're writing portable code, you should not
> assume any more than the language guarantees.
> 
> If you need an integer of a specific size, use types like int32_t or
> int64_t.  These are part of C99 and C++0x.  If they don't exist on some
> platform you need to support, they are easy to typedef.

That's exactly the reason we test it at configure time - e.g. to find a data type to use for 4-byte integers, and whether there is any 8-byte type present for ~50 different OS/compiler combinations. 

However, let's leave the "why" aside for now - I already worked around the specific issue. 

Still, there are tons of other things at configure time that might depend on your architecture, and CMake has plenty of routines for such tests, so hopefully we can agree that if CMake allows the user to 

(1) change the OS X architecture and  
(2) check for things at configuration time,

it's also a pretty reasonable goal to try and get the correct result from those test - isn't it?  :-)

Thus, back to my question: Wouldn't it make sense in this case to force the user to set the OS X architecture(s) at the same time as the compiler, and/or invalidate the cache when it changes? (just as CMake already does for the compilers)?

 
Cheers,

Erik

----------------------------------------------------------
Erik Lindahl <lindahl at cbr.su.se>
Professor, Computational Structural Biology
Center for Biomembrane Research & Swedish e-Science Research Center
Department of Biochemistry & Biophysics, Stockholm University
Tel: +468164675 Cell: +46703844534



More information about the CMake mailing list