[CMake] How do you determine what compiler is being used?
Eric Noulard
eric.noulard at gmail.com
Wed Dec 3 18:06:14 EST 2008
2008/12/3 Bartlett, Roscoe A <rabartl at sandia.gov>:
> Hello,
>
> How can determine what general type of compiler is being used? For example,
> how can we determine if our project is being configured to use the Sun CC
> compiler? In C++ code I can just check for the define __sun but how can I
> get this info in my CMakeLists.txt file? I could use try_compile(...) to
> figure this out but is there already a way to do this?
There are some variables like
CMAKE_COMPILER_IS_GNUCC
MINGW
MSVC
but there is nothing for Sun CC
http://www.cmake.org/Wiki/CMake_Useful_Variables
You may guess it using
CMAKE_C_COMPILER
which contains the full path to the compiler.
may be the set of recognized compilers may be enhanced using
macro predefined by those compilers:
http://predef.sourceforge.net/precomp.html
--
Erk
More information about the CMake
mailing list