[Cmake-commits] CMake branch, next, updated. v2.8.7-2032-gf4ff859

Brad King brad.king at kitware.com
Mon Jan 9 14:35:51 EST 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  f4ff8598071cf7a38480dbeac433d79b1b292637 (commit)
       via  75d7c08859ffa47faff1bf40f532823b4b723515 (commit)
       via  c198730b4558d03b9b98a5eedbf5653eb79ac09d (commit)
       via  5899b988d5306a301b768eadd43bc3ff4b6b839b (commit)
       via  b8cfa656ce7a59bc616eda8d4180ea9642291d07 (commit)
       via  6dae6660fce095681c41fada1d29ab7c80eb8810 (commit)
       via  4080d5510e5a97de8f3659b5ca4c88d17b81f31d (commit)
       via  2cc205a0fb070a5022a6b1c449dafb2423b8fbdb (commit)
       via  a6d83ccea9075af783b91f86c37af1f4ec11b5bd (commit)
       via  a66285583d5d5426ead606dd1175f0c6d664ce47 (commit)
       via  fa7141f5ad9bc084fefbb898c6cdda9312c5f615 (commit)
      from  41b83a646a5404d0c5faf23224caf7bb6b0f894b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f4ff8598071cf7a38480dbeac433d79b1b292637
commit f4ff8598071cf7a38480dbeac433d79b1b292637
Merge: 41b83a6 75d7c08
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Jan 9 14:35:35 2012 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Jan 9 14:35:35 2012 -0500

    Merge topic 'compiler-version' into next
    
    75d7c08 Detect SunPro compiler version with its id
    c198730 Detect Watcom compiler version with its id
    5899b98 Detect Clang compiler version with its id
    b8cfa65 Detect PGI compiler version with its id
    6dae666 Detect IBM XL compiler version with its id
    4080d55 Detect Borland compiler version with its id
    2cc205a Detect Intel compiler version with its id (#11937)
    a6d83cc Detect MSVC compiler version with its id
    a662855 Detect GNU compiler version with its id (#6251)
    fa7141f Add framework to detect compiler version with its id (#12408)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=75d7c08859ffa47faff1bf40f532823b4b723515
commit 75d7c08859ffa47faff1bf40f532823b4b723515
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Dec 7 09:22:11 2011 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 09:39:50 2011 -0500

    Detect SunPro compiler version with its id
    
    Decode hex digits from __SUNPRO_C and __SUNPRO_CC to compute the version
    number components.  Note that the constant encodes decimal digits as hex
    digits (never larger than 9).  We represent them as decimal after
    extraction.  See documentation at
    
      http://predef.sourceforge.net/precomp.html

diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index af59349..692c1fd 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -33,6 +33,9 @@
 
 #elif defined(__SUNPRO_C)
 # define COMPILER_ID "SunPro"
+# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8)
+# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF)
+# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C    & 0xF)
 
 #elif defined(__HP_cc)
 # define COMPILER_ID "HP"
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index d3fcc4b..d983dc2 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -35,6 +35,9 @@
 
 #elif defined(__SUNPRO_CC)
 # define COMPILER_ID "SunPro"
+# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8)
+# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF)
+# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC    & 0xF)
 
 #elif defined(__HP_aCC)
 # define COMPILER_ID "HP"

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c198730b4558d03b9b98a5eedbf5653eb79ac09d
commit c198730b4558d03b9b98a5eedbf5653eb79ac09d
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Dec 7 09:18:13 2011 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 09:39:50 2011 -0500

    Detect Watcom compiler version with its id
    
    Decode decimal digits from __WATCOMC__ to compute the version number
    components.  See documentation at:
    
      http://predef.sourceforge.net/precomp.html

diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index cfa65c2..af59349 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -28,6 +28,8 @@
 
 #elif defined(__WATCOMC__)
 # define COMPILER_ID "Watcom"
+# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
+# define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100)
 
 #elif defined(__SUNPRO_C)
 # define COMPILER_ID "SunPro"
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index 19fa730..d3fcc4b 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -30,6 +30,8 @@
 
 #elif defined(__WATCOMC__)
 # define COMPILER_ID "Watcom"
+# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
+# define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100)
 
 #elif defined(__SUNPRO_CC)
 # define COMPILER_ID "SunPro"

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5899b988d5306a301b768eadd43bc3ff4b6b839b
commit 5899b988d5306a301b768eadd43bc3ff4b6b839b
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Dec 6 15:14:47 2011 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 09:39:49 2011 -0500

    Detect Clang compiler version with its id
    
    Decode decimal digits from
    
      __clang_major__
      __clang_minor__
      __clang_patchlevel__
    
    to compute version number components.  See documentation at:
    
      http://clang.llvm.org/docs/LanguageExtensions.html#builtinmacros
      http://predef.sourceforge.net/precomp.html

diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index 6bae3a2..cfa65c2 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -17,6 +17,9 @@
 
 #elif defined(__clang__)
 # define COMPILER_ID "Clang"
+# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
+# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
+# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
 
 #elif defined(__BORLANDC__)
 # define COMPILER_ID "Borland"
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index f2d6f6b..19fa730 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -19,6 +19,9 @@
 
 #elif defined(__clang__)
 # define COMPILER_ID "Clang"
+# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
+# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
+# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
 
 #elif defined(__BORLANDC__)
 # define COMPILER_ID "Borland"

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b8cfa656ce7a59bc616eda8d4180ea9642291d07
commit b8cfa656ce7a59bc616eda8d4180ea9642291d07
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Dec 6 15:10:29 2011 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 09:39:48 2011 -0500

    Detect PGI compiler version with its id
    
    Decode decimal digits from
    
      __PGIC__
      __PGIC_MINOR__
      __PGIC_PATCHLEVEL__
    
    to compute version number components.

diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index e7738cf..6bae3a2 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -51,6 +51,11 @@
 
 #elif defined(__PGI)
 # define COMPILER_ID "PGI"
+# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
+# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
+# if defined(__PGIC_PATCHLEVEL__)
+#  define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
+# endif
 
 #elif defined(__PATHSCALE__)
 # define COMPILER_ID "PathScale"
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index 52ed6b2..f2d6f6b 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -53,6 +53,11 @@
 
 #elif defined(__PGI)
 # define COMPILER_ID "PGI"
+# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
+# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
+# if defined(__PGIC_PATCHLEVEL__)
+#  define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
+# endif
 
 #elif defined(__PATHSCALE__)
 # define COMPILER_ID "PathScale"

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6dae6660fce095681c41fada1d29ab7c80eb8810
commit 6dae6660fce095681c41fada1d29ab7c80eb8810
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Dec 6 12:07:35 2011 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 09:39:47 2011 -0500

    Detect IBM XL compiler version with its id
    
    Decode decimal digits from __IBMC__ and __IBMCPP__ to compute version
    number components.  See documentation at:
    
      http://predef.sourceforge.net/precomp.html
      http://publib.boulder.ibm.com/infocenter/comphelp/v111v131/topic/com.ibm.xlc111.aix.doc/compiler_ref/xlmacros.html
      http://publib.boulder.ibm.com/infocenter/comphelp/v111v131/topic/com.ibm.xlcpp111.aix.doc/compiler_ref/xlmacros.html

diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index 5afe99f..e7738cf 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -38,10 +38,15 @@
 #elif defined(__IBMC__)
 # if defined(__COMPILER_VER__)
 #  define COMPILER_ID "zOS"
-# elif __IBMC__ >= 800
-#  define COMPILER_ID "XL"
 # else
-#  define COMPILER_ID "VisualAge"
+#  if __IBMC__ >= 800
+#   define COMPILER_ID "XL"
+#  else
+#   define COMPILER_ID "VisualAge"
+#  endif
+#  define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
+#  define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
+#  define COMPILER_VERSION_PATCH DEC(__IBMC__    % 10)
 # endif
 
 #elif defined(__PGI)
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index 4c42f8a..52ed6b2 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -40,10 +40,15 @@
 #elif defined(__IBMCPP__)
 # if defined(__COMPILER_VER__)
 #  define COMPILER_ID "zOS"
-# elif __IBMCPP__ >= 800
-#  define COMPILER_ID "XL"
 # else
-#  define COMPILER_ID "VisualAge"
+#  if __IBMCPP__ >= 800
+#   define COMPILER_ID "XL"
+#  else
+#   define COMPILER_ID "VisualAge"
+#  endif
+#  define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
+#  define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
+#  define COMPILER_VERSION_PATCH DEC(__IBMCPP__    % 10)
 # endif
 
 #elif defined(__PGI)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4080d5510e5a97de8f3659b5ca4c88d17b81f31d
commit 4080d5510e5a97de8f3659b5ca4c88d17b81f31d
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Dec 6 12:06:06 2011 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 09:39:46 2011 -0500

    Detect Borland compiler version with its id
    
    Decode hex digits from __BORLANDC__ to compute the version number
    components.  Note that the constant encodes decimal digits as hex digits
    (never larger than 9).  We represent them as decimal after extraction.
    See documentation at
    
      http://predef.sourceforge.net/precomp.html
      http://docwiki.embarcadero.com/RADStudio/en/Predefined_Macros

diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index e9a8efd..5afe99f 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -20,6 +20,8 @@
 
 #elif defined(__BORLANDC__)
 # define COMPILER_ID "Borland"
+# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
+# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
 
 #elif defined(__WATCOMC__)
 # define COMPILER_ID "Watcom"
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index bdc520c..4c42f8a 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -22,6 +22,8 @@
 
 #elif defined(__BORLANDC__)
 # define COMPILER_ID "Borland"
+# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
+# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
 
 #elif defined(__WATCOMC__)
 # define COMPILER_ID "Watcom"

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2cc205a0fb070a5022a6b1c449dafb2423b8fbdb
commit 2cc205a0fb070a5022a6b1c449dafb2423b8fbdb
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Dec 6 11:54:58 2011 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 09:39:45 2011 -0500

    Detect Intel compiler version with its id (#11937)
    
    Decode decimal digits from
    
      __INTEL_COMPILER
      __INTEL_COMPILER_BUILD_DATE
    
    to compute the version number components.  See documentation at:
    
      http://predef.sourceforge.net/precomp.html
      http://software.intel.com/sites/products/documentation/hpc/compilerpro/en-us/fortran/lin/compiler_f/bldaps_for/common/bldaps_use_presym.htm

diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index 7a76897..e9a8efd 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -8,6 +8,12 @@
 
 #if defined(__INTEL_COMPILER) || defined(__ICC)
 # define COMPILER_ID "Intel"
+# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
+# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
+# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER    % 10)
+# if defined(__INTEL_COMPILER_BUILD_DATE)
+#  define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
+# endif
 
 #elif defined(__clang__)
 # define COMPILER_ID "Clang"
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index 9e21cbd..bdc520c 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -10,6 +10,12 @@
 
 #elif defined(__INTEL_COMPILER) || defined(__ICC)
 # define COMPILER_ID "Intel"
+# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
+# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
+# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER    % 10)
+# if defined(__INTEL_COMPILER_BUILD_DATE)
+#  define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
+# endif
 
 #elif defined(__clang__)
 # define COMPILER_ID "Clang"

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a6d83ccea9075af783b91f86c37af1f4ec11b5bd
commit a6d83ccea9075af783b91f86c37af1f4ec11b5bd
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Dec 6 11:56:51 2011 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:59:53 2011 -0500

    Detect MSVC compiler version with its id
    
    Decode decimal digits from _MSC_VER, _MSC_FULL_VER, and _MSC_BUILD to
    compute the version number components.  See documentation at:
    
      http://msdn.microsoft.com/en-us/library/b0084kay.aspx
      http://predef.sourceforge.net/precomp.html

diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index 25e4947..7a76897 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -61,6 +61,18 @@
 
 #elif defined(_MSC_VER)
 # define COMPILER_ID "MSVC"
+# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
+# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
+# if defined(_MSC_FULL_VER)
+#  if _MSC_VER >= 1400
+#   define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
+#  else
+#   define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
+#  endif
+# endif
+# if defined(_MSC_BUILD)
+#  define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
+# endif
 
 #elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
 /* Analog Devices C++ compiler for Blackfin, TigerSHARC and
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index 6494c27..9e21cbd 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -63,6 +63,18 @@
 
 #elif defined(_MSC_VER)
 # define COMPILER_ID "MSVC"
+# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
+# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
+# if defined(_MSC_FULL_VER)
+#  if _MSC_VER >= 1400
+#   define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
+#  else
+#   define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
+#  endif
+# endif
+# if defined(_MSC_BUILD)
+#  define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
+# endif
 
 #elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
 /* Analog Devices C++ compiler for Blackfin, TigerSHARC and

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a66285583d5d5426ead606dd1175f0c6d664ce47
commit a66285583d5d5426ead606dd1175f0c6d664ce47
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Dec 6 11:56:43 2011 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:59:52 2011 -0500

    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

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"

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fa7141f5ad9bc084fefbb898c6cdda9312c5f615
commit fa7141f5ad9bc084fefbb898c6cdda9312c5f615
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Dec 5 09:44:09 2011 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 7 08:59:51 2011 -0500

    Add framework to detect compiler version with its id (#12408)
    
    Teach CMakePlatformId.h to construct an "INFO:compiler_version[]" string
    literal from macros COMPILER_VERSION_(MAJOR|MINOR|PATCH|TWEAK) to be
    defined in CMake(C|CXX)CompilerId.(c|cpp) for each compiler.  Provide
    conversion macros DEC() and HEX() to decode decimal or hex digits from
    integer values.  Parse the version out of the compiler id binary along
    with the other INFO values already present.
    
    Store the result in variable CMAKE_<LANG>_COMPILER_VERSION in the format
    "major[.minor[.patch[.tweak]]]".  Save the value persistently in
    CMake(C|CXX)Compiler.cmake in the build tree.  Document the variable for
    internal use since we do not set it everywhere yet.
    
    Report the compiler version on the compiler id result line e.g.
    
      The C compiler identification is GNU 4.5.2
    
    Report CMAKE_(C|CXX)_COMPILER_(ID|VERSION) in SystemInformation test.

diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in
index 04a5cec..b14cf34 100644
--- a/Modules/CMakeCCompiler.cmake.in
+++ b/Modules/CMakeCCompiler.cmake.in
@@ -1,6 +1,7 @@
 SET(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@")
 SET(CMAKE_C_COMPILER_ARG1 "@CMAKE_C_COMPILER_ARG1@")
 SET(CMAKE_C_COMPILER_ID "@CMAKE_C_COMPILER_ID@")
+SET(CMAKE_C_COMPILER_VERSION "@CMAKE_C_COMPILER_VERSION@")
 SET(CMAKE_C_PLATFORM_ID "@CMAKE_C_PLATFORM_ID@")
 @SET_MSVC_C_ARCHITECTURE_ID@
 SET(CMAKE_AR "@CMAKE_AR@")
diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index c91553a..dd3d2fd 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -109,6 +109,9 @@ int main(int argc, char* argv[])
   require += info_compiler[argc];
   require += info_platform[argc];
   require += info_arch[argc];
+#ifdef COMPILER_VERSION_MAJOR
+  require += info_version[argc];
+#endif
   (void)argv;
   return require;
 }
diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in
index ea06526..bc3bc2e 100644
--- a/Modules/CMakeCXXCompiler.cmake.in
+++ b/Modules/CMakeCXXCompiler.cmake.in
@@ -1,6 +1,7 @@
 SET(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@")
 SET(CMAKE_CXX_COMPILER_ARG1 "@CMAKE_CXX_COMPILER_ARG1@")
 SET(CMAKE_CXX_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@")
+SET(CMAKE_CXX_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@")
 SET(CMAKE_CXX_PLATFORM_ID "@CMAKE_CXX_PLATFORM_ID@")
 @SET_MSVC_CXX_ARCHITECTURE_ID@
 SET(CMAKE_AR "@CMAKE_AR@")
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index 4c8f497..469290e 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -96,6 +96,9 @@ int main(int argc, char* argv[])
   int require = 0;
   require += info_compiler[argc];
   require += info_platform[argc];
+#ifdef COMPILER_VERSION_MAJOR
+  require += info_version[argc];
+#endif
   (void)argv;
   return require;
 }
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index b160dee..686cc9b 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -55,8 +55,13 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
 
   # Display the final identification result.
   IF(CMAKE_${lang}_COMPILER_ID)
+    IF(CMAKE_${lang}_COMPILER_VERSION)
+      SET(_version " ${CMAKE_${lang}_COMPILER_VERSION}")
+    ELSE()
+      SET(_version "")
+    ENDIF()
     MESSAGE(STATUS "The ${lang} compiler identification is "
-      "${CMAKE_${lang}_COMPILER_ID}")
+      "${CMAKE_${lang}_COMPILER_ID}${_version}")
   ELSE(CMAKE_${lang}_COMPILER_ID)
     MESSAGE(STATUS "The ${lang} compiler identification is unknown")
   ENDIF(CMAKE_${lang}_COMPILER_ID)
@@ -65,6 +70,7 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
   SET(CMAKE_${lang}_PLATFORM_ID "${CMAKE_${lang}_PLATFORM_ID}" PARENT_SCOPE)
   SET(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}"
     PARENT_SCOPE)
+  SET(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE)
 ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID)
 
 #-----------------------------------------------------------------------------
@@ -177,9 +183,10 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
   IF(NOT CMAKE_${lang}_COMPILER_ID)
     # Read the compiler identification string from the executable file.
     SET(COMPILER_ID)
+    SET(COMPILER_VERSION)
     SET(PLATFORM_ID)
     FILE(STRINGS ${file}
-      CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 3 REGEX "INFO:")
+      CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 4 REGEX "INFO:")
     SET(HAVE_COMPILER_TWICE 0)
     FOREACH(info ${CMAKE_${lang}_COMPILER_ID_STRINGS})
       IF("${info}" MATCHES ".*INFO:compiler\\[([^]\"]*)\\].*")
@@ -197,6 +204,11 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
         STRING(REGEX REPLACE ".*INFO:arch\\[([^]]*)\\].*" "\\1"
           ARCHITECTURE_ID "${info}")
       ENDIF("${info}" MATCHES ".*INFO:arch\\[([^]\"]*)\\].*")
+      IF("${info}" MATCHES ".*INFO:compiler_version\\[([^]\"]*)\\].*")
+        STRING(REGEX REPLACE ".*INFO:compiler_version\\[([^]]*)\\].*" "\\1" COMPILER_VERSION "${info}")
+        STRING(REGEX REPLACE "^0+([0-9])" "\\1" COMPILER_VERSION "${COMPILER_VERSION}")
+        STRING(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION "${COMPILER_VERSION}")
+      ENDIF("${info}" MATCHES ".*INFO:compiler_version\\[([^]\"]*)\\].*")
     ENDFOREACH(info)
 
     # Check if a valid compiler and platform were found.
@@ -204,6 +216,7 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
       SET(CMAKE_${lang}_COMPILER_ID "${COMPILER_ID}")
       SET(CMAKE_${lang}_PLATFORM_ID "${PLATFORM_ID}")
       SET(MSVC_${lang}_ARCHITECTURE_ID "${ARCHITECTURE_ID}")
+      SET(CMAKE_${lang}_COMPILER_VERSION "${COMPILER_VERSION}")
     ENDIF(COMPILER_ID AND NOT COMPILER_ID_TWICE)
 
     # Check the compiler identification string.
@@ -251,6 +264,7 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
   SET(CMAKE_${lang}_PLATFORM_ID "${CMAKE_${lang}_PLATFORM_ID}" PARENT_SCOPE)
   SET(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}"
     PARENT_SCOPE)
+  SET(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE)
   SET(CMAKE_EXECUTABLE_FORMAT "${CMAKE_EXECUTABLE_FORMAT}" PARENT_SCOPE)
 ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang)
 
diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in
index cb3f40a..b69bf63 100644
--- a/Modules/CMakePlatformId.h.in
+++ b/Modules/CMakePlatformId.h.in
@@ -105,6 +105,46 @@
 #  define ARCHITECTURE_ID ""
 #endif
 
+/* Convert integer to decimal digit literals.  */
+#define DEC(n)                   \
+  ('0' + (((n) / 10000000)%10)), \
+  ('0' + (((n) / 1000000)%10)),  \
+  ('0' + (((n) / 100000)%10)),   \
+  ('0' + (((n) / 10000)%10)),    \
+  ('0' + (((n) / 1000)%10)),     \
+  ('0' + (((n) / 100)%10)),      \
+  ('0' + (((n) / 10)%10)),       \
+  ('0' +  ((n) % 10))
+
+/* Convert integer to hex digit literals.  */
+#define HEX(n)             \
+  ('0' + ((n)>>28 & 0xF)), \
+  ('0' + ((n)>>24 & 0xF)), \
+  ('0' + ((n)>>20 & 0xF)), \
+  ('0' + ((n)>>16 & 0xF)), \
+  ('0' + ((n)>>12 & 0xF)), \
+  ('0' + ((n)>>8  & 0xF)), \
+  ('0' + ((n)>>4  & 0xF)), \
+  ('0' + ((n)     & 0xF))
+
+/* Construct a string literal encoding the version number components. */
+#ifdef COMPILER_VERSION_MAJOR
+char const info_version[] = {
+  'I', 'N', 'F', 'O', ':',
+  'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
+  COMPILER_VERSION_MAJOR,
+# ifdef COMPILER_VERSION_MINOR
+  '.', COMPILER_VERSION_MINOR,
+#  ifdef COMPILER_VERSION_PATCH
+   '.', COMPILER_VERSION_PATCH,
+#   ifdef COMPILER_VERSION_TWEAK
+    '.', COMPILER_VERSION_TWEAK,
+#   endif
+#  endif
+# endif
+  ']','\0'};
+#endif
+
 /* Construct the string literal in pieces to prevent the source from
    getting matched.  Store it in a pointer rather than an array
    because some compilers will just produce instructions to fill the
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx
index ed303c9..ad119ea 100644
--- a/Source/cmDocumentVariables.cxx
+++ b/Source/cmDocumentVariables.cxx
@@ -1279,6 +1279,15 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
      "Variables for Languages");
 
   cm->DefineProperty
+    ("CMAKE_<LANG>_COMPILER_VERSION", cmProperty::VARIABLE,
+     "An internal variable subject to change.",
+     "Compiler version in major[.minor[.patch[.tweak]]] format.  "
+     "This variable is reserved for internal use by CMake and is not "
+     "guaranteed to be set.",
+     false,
+     "Variables for Languages");
+
+  cm->DefineProperty
     ("CMAKE_INTERNAL_PLATFORM_ABI", cmProperty::VARIABLE,
      "An internal variable subject to change.",
      "This is used in determining the compiler ABI and is subject to change.",
diff --git a/Tests/SystemInformation/SystemInformation.in b/Tests/SystemInformation/SystemInformation.in
index 1055d07..90ae20a 100644
--- a/Tests/SystemInformation/SystemInformation.in
+++ b/Tests/SystemInformation/SystemInformation.in
@@ -17,6 +17,10 @@ CMAKE_CXX_COMPILER == "${CMAKE_CXX_COMPILER}"
 CMAKE_C_COMPILER == "${CMAKE_C_COMPILER}"
 CMAKE_COMPILER_IS_GNUCC == "${CMAKE_COMPILER_IS_GNUCC}"
 CMAKE_COMPILER_IS_GNUCXX == "${CMAKE_COMPILER_IS_GNUCXX}"
+CMAKE_C_COMPILER_ID == "${CMAKE_C_COMPILER_ID}"
+CMAKE_C_COMPILER_VERSION == "${CMAKE_C_COMPILER_VERSION}"
+CMAKE_CXX_COMPILER_ID == "${CMAKE_CXX_COMPILER_ID}"
+CMAKE_CXX_COMPILER_VERSION == "${CMAKE_CXX_COMPILER_VERSION}"
 
 // C shared library flag
 CMAKE_SHARED_LIBRARY_C_FLAGS == "${CMAKE_SHARED_LIBRARY_C_FLAGS}"

-----------------------------------------------------------------------

Summary of changes:
 Modules/CMakeCCompiler.cmake.in              |    1 +
 Modules/CMakeCCompilerId.c.in                |   52 ++++++++++++++++++++++++-
 Modules/CMakeCXXCompiler.cmake.in            |    1 +
 Modules/CMakeCXXCompilerId.cpp.in            |   52 ++++++++++++++++++++++++-
 Modules/CMakeDetermineCompilerId.cmake       |   18 ++++++++-
 Modules/CMakePlatformId.h.in                 |   40 ++++++++++++++++++++
 Source/cmDocumentVariables.cxx               |    9 ++++
 Tests/SystemInformation/SystemInformation.in |    4 ++
 8 files changed, 169 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list