Hi,

I enclosed patch to fix COMPILER_VERSION variable value for Open Watcom 
compilers to be real
version, not internal number.
It fix also value for PLATFORM_ID and ARCHITECTURE_ID variables for Open Watcom 
compilers.

Regards

Jiri
>From f9cd8c3af343595e979827622d9c6a1a49912c47 Mon Sep 17 00:00:00 2001
From: Jiri Malak <[email protected]>
Date: Thu, 13 Mar 2014 22:05:22 +0100
Subject: [PATCH] Correct platform related variables for Open Watcom compilers

 correct COMPILER_VERSION variable to hold real Open Watcom compiler version 
 Fill ARCHITECTURE_ID and PLATFORM_ID variables for Open Watcom compilers

---
 Modules/CMakeCCompilerId.c.in                |  6 +++---
 Modules/CMakeCXXCompilerId.cpp.in            |  6 +++---
 Modules/CMakePlatformId.h.in                 | 13 ++++++++++++-
 Modules/InstallRequiredSystemLibraries.cmake |  4 ----
 Modules/Platform/Windows-wcl386.cmake        |  8 ++++----
 5 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index 52f9590..acab358 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -65,9 +65,9 @@
 
 #elif defined(__WATCOMC__)
 # define COMPILER_ID "Watcom"
-  /* __WATCOMC__ = VVRR */
-# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
-# define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100)
+  /* __WATCOMC__ = VVRR + 1100 Open Watcom */
+# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100 ) / 100)
+# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
 
 #elif defined(__SUNPRO_C)
 # define COMPILER_ID "SunPro"
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index 25ceb3f..eee8ffe 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -70,9 +70,9 @@
 
 #elif defined(__WATCOMC__)
 # define COMPILER_ID "Watcom"
-  /* __WATCOMC__ = VVRR */
-# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
-# define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100)
+  /* __WATCOMC__ = VVRR + 1100 Open Watcom */
+# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100 ) / 100)
+# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
 
 #elif defined(__SUNPRO_CC)
 # define COMPILER_ID "SunPro"
diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in
index 1e41fec..2a3c1d8 100644
--- a/Modules/CMakePlatformId.h.in
+++ b/Modules/CMakePlatformId.h.in
@@ -1,5 +1,5 @@
 /* Identify known platforms by name.  */
-#if defined(__linux) || defined(__linux__) || defined(linux)
+#if defined(__linux) || defined(__linux__) || defined(linux) || defined(__LINUX__)
 # define PLATFORM_ID "Linux"
 
 #elif defined(__CYGWIN__)
@@ -107,6 +107,17 @@
 #  define ARCHITECTURE_ID ""
 # endif
 
+#elif defined(__WATCOMC__)
+# if defined(_M_I86)
+#  define ARCHITECTURE_ID "I86"
+
+# elif defined(_M_IX86)
+#  define ARCHITECTURE_ID "X86"
+
+# else /* unknown architecture */
+#  define ARCHITECTURE_ID ""
+# endif
+
 #else
 #  define ARCHITECTURE_ID ""
 #endif
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake
index 7e68e8f..4b551e6 100644
--- a/Modules/InstallRequiredSystemLibraries.cmake
+++ b/Modules/InstallRequiredSystemLibraries.cmake
@@ -374,10 +374,6 @@ if(WATCOM)
   string(REGEX MATCHALL "[0-9]+" _watcom_version_list "${_compiler_version}")
   list(GET _watcom_version_list 0 _watcom_major)
   list(GET _watcom_version_list 1 _watcom_minor)
-  if(${_watcom_major} GREATER 11)
-    math(EXPR _watcom_major "${_watcom_major} - 11")
-  endif()
-  math(EXPR _watcom_minor "${_watcom_minor} / 10")
   set( __install__libs
     ${CompilerPath}/clbr${_watcom_major}${_watcom_minor}.dll
     ${CompilerPath}/mt7r${_watcom_major}${_watcom_minor}.dll
diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake
index d40d718..83382d9 100644
--- a/Modules/Platform/Windows-wcl386.cmake
+++ b/Modules/Platform/Windows-wcl386.cmake
@@ -93,16 +93,16 @@ if(NOT _CMAKE_WATCOM_VERSION)
   set(WATCOM17)
   set(WATCOM18)
   set(WATCOM19)
-  if("${_compiler_version}" LESS 12.70)
+  if("${_compiler_version}" LESS 1.7)
     set(WATCOM16 1)
   endif()
-  if("${_compiler_version}" EQUAL 12.70)
+  if("${_compiler_version}" EQUAL 1.7)
     set(WATCOM17 1)
   endif()
-  if("${_compiler_version}" EQUAL 12.80)
+  if("${_compiler_version}" EQUAL 1.8)
     set(WATCOM18 1)
   endif()
-  if("${_compiler_version}" EQUAL 12.90)
+  if("${_compiler_version}" EQUAL 1.9)
     set(WATCOM19 1)
   endif()
 endif()
-- 
1.7.11.msysgit.0

 
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to