[CMake] Getting the compiler version?

Brad King brad.king at kitware.com
Wed Apr 15 09:00:32 EDT 2009


Philip Lowman wrote:
> On Tue, Apr 14, 2009 at 11:17 AM, Bartlett, Roscoe A <rabartl at sandia.gov 
> <mailto:rabartl at sandia.gov>> wrote:
> 
>     Thanks for the pointer.  We will look into this and try to create a
>     module that other people could use also.  However, it would be good
>     if we could get this added as an official CMake module that can be
>     supported by a broader community.
> 
> You might be able to get a lot of what you're looking for from 
> preprocessor definitions.  These could be wrapped into a CMake function 
> that calls try_run()
> 
> http://predef.sf.net

Currently the CMAKE_<LANG>_COMPILER_ID variables are computed using the
preprocessor.  Basically we compile a source file with default flags and
then read the strings directly out of the resulting binaries (which works
for cross-compiling too).  I want to extend this to get the compiler
version and perhaps some other information in one step, but I've not had
time to do it yet.

-Brad



More information about the CMake mailing list