Bred,
I enclosed corrected patches.
Open Watcom didn't use last digit up to now.
For Watcom I looked into history and it was used as patch version. I correct
patch to use last
digit as patch version.
I suppress patch number for base version (0 patch) to follow generaly used
Watcom/Open Watcom
versions.
I add for second patch more platforms.
Regards
Jiri
> On 03/14/2014 02:27 PM, Jiri Malak wrote:
>> I enclosed both patches.
>
> Thanks. Here are some more comments.
>
> The version extraction logic is currently:
>
>> + /* __WATCOMC__ = VVRR + 1100 Open Watcom */
>> +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100 ) / 100) +# define
COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
>
> The comment does not match the implementation. It looks like
> the least-significant digit is not part of the minor version
> number according to the implementation. The comment should
> then read "VVR0" instead of "VVRR". What is the purpose of
> the least-significant digit in Open Watcom? Is it a patch level?
>
> I see several updates of the form:
>
>> -if ("${CMAKE_CXX_COMPILER_ID}" MATCHES Watcom)
>> +if ("${CMAKE_CXX_COMPILER_ID}" MATCHES Watcom
>> + OR "${CMAKE_CXX_COMPILER_ID}" MATCHES OpenWatcom)
>
> but the MATCHES test is already a regex so you do not need
> to test both variants. Most of these updates can be dropped.
>
> There is a lingering problem from the old code that this
> hunk indents:
>
>> + if("${_compiler_version}" LESS 1.7)
>> + set(WATCOM16 1)
>> + endif()
>> + if("${_compiler_version}" EQUAL 1.7)
>> + set(WATCOM17 1)
>> + endif()
>> + if("${_compiler_version}" EQUAL 1.8)
>> + set(WATCOM18 1)
>> + endif()
>> + if("${_compiler_version}" EQUAL 1.9)
>> + set(WATCOM19 1)
>> + endif()
>
> The version comparisons should use VERSION_LESS and
> VERSION_EQUAL to get component-wise tests.
>
> In InstallRequiredSystemLibraries:
>
>> + if(_compiler_id MATCHES "Watcom")
>> + math(EXPR _watcom_minor "${_watcom_minor} / 10")
>
> should use STREQUAL instead of MATCHES or OpenWatcom will match.
>
> Thanks,
> -Brad
>
> --
>
> 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
>
>From 4b59f5f95f232628b3388ac4af3707146b017c56 Mon Sep 17 00:00:00 2001
From: Jiri Malak <[email protected]>
Date: Mon, 17 Mar 2014 19:38:57 +0100
Subject: [PATCH 1/2] Fill ARCHITECTURE_ID and PLATFORM_ID for Open Watcom
compilers
---
Modules/CMakePlatformId.h.in | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in
index 1e41fec..bc26c07 100644
--- a/Modules/CMakePlatformId.h.in
+++ b/Modules/CMakePlatformId.h.in
@@ -74,6 +74,23 @@
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
# define PLATFORM_ID "Xenix"
+#elif defined(__WATCOMC__)
+# if defined(__LINUX__)
+# define PLATFORM_ID "Linux"
+
+# elif defined(__DOS__)
+# define PLATFORM_ID "DOS"
+
+# elif defined(__OS2__)
+# define PLATFORM_ID "OS2"
+
+# elif defined(__WINDOWS__)
+# define PLATFORM_ID "Windows3x"
+
+# else /* unknown platform */
+# define PLATFORM_ID ""
+# endif
+
#else /* unknown platform */
# define PLATFORM_ID ""
@@ -107,6 +124,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
--
1.8.1.4
>From 42804322c708471724781435b1ce48e55ec8dbaf Mon Sep 17 00:00:00 2001
From: Jiri Malak <[email protected]>
Date: Mon, 17 Mar 2014 19:41:02 +0100
Subject: [PATCH 2/2] Corrections for Open Watcom compiler version
---
Modules/CMakeCCompilerId.c.in | 17 +++++++++++++----
Modules/CMakeCXXCompilerId.cpp.in | 17 +++++++++++++----
Modules/InstallRequiredSystemLibraries.cmake | 4 ----
Modules/Platform/Windows-wcl386.cmake | 24 +++++++++++++-----------
4 files changed, 39 insertions(+), 23 deletions(-)
diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index 561ccf2..5ccdc12 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -68,10 +68,19 @@
# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
#elif defined(__WATCOMC__)
-# define COMPILER_ID "Watcom"
- /* __WATCOMC__ = VVRR */
-# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
-# define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100)
+# if __WATCOMC__ < 1200
+# define COMPILER_ID "Watcom"
+ /* __WATCOMC__ = VVRP */
+# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
+# else
+# define COMPILER_ID "OpenWatcom"
+ /* __WATCOMC__ = VVRP + 1100 */
+# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
+# endif
+# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
+# if DEC(__WATCOMC__ % 10) > 0
+# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
+# endif
#elif defined(__SUNPRO_C)
# define COMPILER_ID "SunPro"
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index 6c602d4..4fe8bb8 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -73,10 +73,19 @@
# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
#elif defined(__WATCOMC__)
-# define COMPILER_ID "Watcom"
- /* __WATCOMC__ = VVRR */
-# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
-# define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100)
+# if __WATCOMC__ < 1200
+# define COMPILER_ID "Watcom"
+ /* __WATCOMC__ = VVRP */
+# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
+# else
+# define COMPILER_ID "OpenWatcom"
+ /* __WATCOMC__ = VVRP + 1100 */
+# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
+# endif
+# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
+# if DEC(__WATCOMC__ % 10) > 0
+# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
+# endif
#elif defined(__SUNPRO_CC)
# define COMPILER_ID "SunPro"
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..6b1cfd1 100644
--- a/Modules/Platform/Windows-wcl386.cmake
+++ b/Modules/Platform/Windows-wcl386.cmake
@@ -93,16 +93,18 @@ if(NOT _CMAKE_WATCOM_VERSION)
set(WATCOM17)
set(WATCOM18)
set(WATCOM19)
- if("${_compiler_version}" LESS 12.70)
- set(WATCOM16 1)
- endif()
- if("${_compiler_version}" EQUAL 12.70)
- set(WATCOM17 1)
- endif()
- if("${_compiler_version}" EQUAL 12.80)
- set(WATCOM18 1)
- endif()
- if("${_compiler_version}" EQUAL 12.90)
- set(WATCOM19 1)
+ if("${_compiler_id}" STREQUAL "OpenWatcom")
+ if("${_compiler_version}" VERSION_LESS 1.7)
+ set(WATCOM16 1)
+ endif()
+ if("${_compiler_version}" VERSION_EQUAL 1.7)
+ set(WATCOM17 1)
+ endif()
+ if("${_compiler_version}" VERSION_EQUAL 1.8)
+ set(WATCOM18 1)
+ endif()
+ if("${_compiler_version}" VERSION_EQUAL 1.9)
+ set(WATCOM19 1)
+ endif()
endif()
endif()
--
1.8.1.4--
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