Browse Source

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
Brad King 14 years ago
parent
commit
a66285583d
2 changed files with 10 additions and 0 deletions
  1. 5 0
      Modules/CMakeCCompilerId.c.in
  2. 5 0
      Modules/CMakeCXXCompilerId.cpp.in

+ 5 - 0
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"

+ 5 - 0
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"