summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeCCompilerId.c.in
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-12-07 14:22:11 (GMT)
committerBrad King <brad.king@kitware.com>2012-01-10 16:59:14 (GMT)
commit3dd9fa9d6af775473736a01a8970b107b4e0fd47 (patch)
tree76ffec5ed87b8a679135b3b44fd52c05c15cccc4 /Modules/CMakeCCompilerId.c.in
parentc198730b4558d03b9b98a5eedbf5653eb79ac09d (diff)
downloadCMake-3dd9fa9d6af775473736a01a8970b107b4e0fd47.zip
CMake-3dd9fa9d6af775473736a01a8970b107b4e0fd47.tar.gz
CMake-3dd9fa9d6af775473736a01a8970b107b4e0fd47.tar.bz2
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 Although the documented version number format is 0xVRP where V = Version, R = Revision, P = Patch it holds only though SunPro C/C++ version 5.9. Later versions have a two-digit revision (minor) number so their format is 0xVRRP.
Diffstat (limited to 'Modules/CMakeCCompilerId.c.in')
-rw-r--r--Modules/CMakeCCompilerId.c.in9
1 files changed, 9 insertions, 0 deletions
diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index af59349..85e2671 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -33,6 +33,15 @@
#elif defined(__SUNPRO_C)
# define COMPILER_ID "SunPro"
+# if __SUNPRO_C >= 0x5100
+# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12)
+# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF)
+# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
+# else
+# 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)
+# endif
#elif defined(__HP_cc)
# define COMPILER_ID "HP"