[CMake] How do you determine what compiler is being used?

Bartlett, Roscoe A rabartl at sandia.gov
Fri Dec 5 14:55:54 EST 2008


Bill,

Is there not always the option to just set this manually in the input cache if you need to?  Otherwise, the default value could be something like "UNKNOWN" and then people could check for known systems to make special tweaks.

- Ross

 

> -----Original Message-----
> From: Bill Hoffman [mailto:bill.hoffman at kitware.com] 
> Sent: Friday, December 05, 2008 12:27 PM
> To: Philip Lowman
> Cc: billlist at nycap.rr.com; Bartlett, Roscoe A; 
> cmake at cmake.org; Pawlowski, Roger P
> Subject: Re: [CMake] How do you determine what compiler is being used?
> 
> Philip Lowman wrote:
> 
> >     CMAKE_C_COMPILER_ID
> >     CMAKE_CXX_COMPILER_ID
> >     CMAKE_Fortran_COMPILER_ID
> > 
> > 
> > Thanks for adding this Bill.  With the exception of dealing 
> with MinGW 
> > or differing versions of MSVC this would seem to be a very good 
> > replacement for conditionals like:
> > 
> > IF(CMAKE_COMPILER_IS_GNUCC)
> > IF(MSVC)
> > 
> > Is this feature here to stay?  The documentation doesn't seem very 
> > encouraging. =)
> > 
> >     * *|CMAKE_<LANG>_COMPILER_ID|*: An internal variable 
> subject to change.
> > 
> >       This is used in determining the compiler and is 
> subject to change.
> > 
> OK, so this is not so reliable.  Right now it is even set for 
> MSVC IDE 
> builds.   Also, we wanted to be able to change it in the future. 
> However, it does seem useful.   We would have to figure out a way to 
> drive this from the IDE's to get the correct answers.   It is a 
> bootstrapping issue.  Right now for makefiles this is done 
> with an execute_process on the compiler.  That would have to 
> be different for IDE builds.
> 
> -Bill
> 
> 
> 


More information about the CMake mailing list