[CMake] recommended way to test for msvc/cl ?

Brad King brad.king at kitware.com
Mon Jan 30 14:29:54 EST 2006


Alexander Neundorf wrote:
>>Von: Brad King <brad.king at kitware.com>  
>>Of course, that is a simple solution.  Each of those files should set a   
>>variable to indicate it has been loaded.  I'll make this change.  The   
>  
> :-) 
>   
> How about platform-id's everywhere ? E.g. NETBSD, OPENBSD, IRIX etc. ? 

Yes, these should be set too.

After investigating the places that things like WIN32, UNIX, and BORLAND 
are set I've decided to wait to discuss this with Bill.  We need to 
design a standard way for these to be set in order to account for future 
cross-compling support (possibly with separate host/target settings).  I 
don't want to implement it one way now and change it in a week and break 
your code that uses the first way.

Basically there needs to be a mapping from C pre-processor definitions 
to CMake variables for known platforms and compilers.  Then anything 
that can be tested from the preprocessor can be tested from CMake.  You 
can accomplish these tests in a few cases now by just doing a TRY_RUN 
with the appropriate source containing preprocessor tests.

-Brad


More information about the CMake mailing list