From a66285583d5d5426ead606dd1175f0c6d664ce47 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 6 Dec 2011 11:56:43 -0500 Subject: Detect GNU compiler version with its id (#6251) Decode decimal digits from __GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__ to compute version components. See documentation at http://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html http://predef.sourceforge.net/precomp.html --- Modules/CMakeCCompilerId.c.in | 5 +++++ Modules/CMakeCXXCompilerId.cpp.in | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index dd3d2fd..25e4947 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -53,6 +53,11 @@ #elif defined(__GNUC__) # define COMPILER_ID "GNU" +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif #elif defined(_MSC_VER) # define COMPILER_ID "MSVC" diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index 469290e..6494c27 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -55,6 +55,11 @@ #elif defined(__GNUC__) # define COMPILER_ID "GNU" +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif #elif defined(_MSC_VER) # define COMPILER_ID "MSVC" -- cgit v0.12