[cmake-developers] CheckGNUCompilerVersion

Brad King brad.king at kitware.com
Thu Apr 15 14:50:31 EDT 2010


Andreas Schneider wrote:
> Hi,
> 
> I've created a module to check for the gnu compiler version.
> 
> Example:                                                                                                                                                            
> check_gnu_compiler_version("4.5.0" HAVE_GNU_COMPILER_VERSION)                                                                                                       
> 
> if (HAVE_GNU_COMPILER_VERSION)                                                                                                                                      
>     message(STATUS "GNU compiler version found")                                                                                                                     
> endif (HAVE_GNU_COMPILER_VERSION)
> 
> I just wanted to get some opinions about it. Maybe someone has some idea for 
> improvement.

A year ago I started working on automatic detection of the
compiler version for all vendors.  When CMake detects the
compiler id (for CMAKE_C_COMPILER_ID) it uses the preprocessor
to recognize the compiler.  There is no reason we cannot
get the compiler version at the same time (at least for C
and C++, but Fortran may be tricky even with preprocessing).

Unfortunately I never had time to get back to this.  If you
want to try it I can send you what I have so far.

-Brad



More information about the cmake-developers mailing list