[Cmake] getting GCC version

Nitin Gupta ngupta at GlobespanVirata . com
Tue, 23 Dec 2003 16:06:42 +0530


Try this:

EXEC_PROGRAM(gcc ARGS --version OUTPUT_VARIABLE CMAKE_C_COMPILER_VERSION)
IF(CMAKE_C_COMPILER_VERSION MATCHES ".*3\\.[0-9].*")
MESSAGE("gcc 3.x")
ELSE(CMAKE_C_COMPILER_VERSION MATCHES ".*3\\.[0-9].*")
MESSAGE("gcc not 3.x")
ENDIF(CMAKE_C_COMPILER_VERSION MATCHES ".*3\\.[0-9].*")

Regards,
Nitin

> -----Original Message-----
> From: cmake-admin at www . cmake . org [mailto:cmake-admin at www . cmake . org]On
> Behalf Of Samson Timoner
> Sent: Monday, December 22, 2003 9:11 PM
> To: cmake at www . cmake . org
> Subject: [Cmake] getting GCC version
>
>
>
> I have some code that when compiled using GCC, requires gcc 3.0
> or greater.
> Once it is known in the cmake file that the compiler is GCC, is there a
> relatively easy way to get the GCC version number?
>
> I'd like CMAKE to spit out an error message if the GCC version is too low.
>
>  Thanks in advance,
>
> -- Samson
> _______________________________________________
> Cmake mailing list
> Cmake at www . cmake . org
> http://www . cmake . org/mailman/listinfo/cmake
>