[CMake] Suggestion for CMake platform/compiler detection

Brandon J. Van Every bvanevery at gmail.com
Wed Nov 15 12:35:28 EST 2006


Alexander Neundorf wrote:
> CMake has some of that.
> It has for OS:
> UNIX
> APPLE
> WIN32
> CYGWIN
> MINGW
>   

Cygwin is not an OS, it's a compiler.

The Bash that comes with Cygwin provides a filesystem environment.  
Oftentimes when people compile on Windows in open source land, what they 
really want / need to know is the difference between various shells.  Is 
it Cygwin Bash, MSYS Bash, straight Windows Command Prompt, or something 
else?


>
> And for the compilers:
> Not sure it has GCC, but at least it has CMAKE_COMPILER_IS_GNUCXX
> BORLAND
> MSVC
> For the Intel Compiler in KDE we currently check using 
> if(CMAKE_C_COMPILER MATCHES "icc")
>
> So there is room for improvement. 
>   


There's coverage, it's just ad hoc, not canonized, and has an 
inconsistent interface.  At present this doesn't trouble me, personally. 

> I think mainly some of the cmake files in Modules/ and Modules/Platforms/ would have to be extended. For compatibility reasons I'm not sure new prefixes like "OS_" and "CC_" would be a good idea.
>   

It would also be good to look at other canonical (OS compiler library 
etc.) specifiers before deciding on such a thing.  Like the Boost 
conventions, for instance.  I do think any canonization should include 
space for a shell specifier, and I don't think any extant canonization 
does that.  Shells are *exceedingly* problematic for builds.  Can't tell 
you how much time I've lost to backslash, escaped whitespace, and double 
quoting issues.


> You know already which sentence follows next... ;-)
> Feel free to send a patch :-)
>
>   

Or at least just file a feature request.


Cheers,
Brandon Van Every



More information about the CMake mailing list