I enclosed both patches.
Regards
Jiri
>From 64effa52febef30653e5c4deb6a6df114e543eb1 Mon Sep 17 00:00:00 2001
From: Jiri Malak <[email protected]>
Date: Fri, 14 Mar 2014 18:42:58 +0100
Subject: [PATCH 1/2] Corrections for Open Watcom compiler version
Add new compiler ID "OpenWatcom" for Open Watcom compilers, "Watcom" is used for original Watcom compilers
Correct COMPILER_VERSION variable to hold real Open Watcom compiler version
---
Modules/CMakeCCompilerId.c.in | 15 ++++++++++----
Modules/CMakeCXXCompilerId.cpp.in | 15 ++++++++++----
Modules/GenerateExportHeader.cmake | 6 ++++--
Modules/InstallRequiredSystemLibraries.cmake | 7 ++++---
Modules/Platform/Windows-wcl386.cmake | 26 ++++++++++++++----------
Source/cmExtraCodeBlocksGenerator.cxx | 2 +-
Tests/Module/GenerateExportHeader/CMakeLists.txt | 3 ++-
Tests/RunCMake/CMakeLists.txt | 1 +
8 files changed, 49 insertions(+), 26 deletions(-)
diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index 52f9590..07d2aff 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -64,10 +64,17 @@
# 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__ = VVRR Watcom */
+# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
+# define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100)
+#else
+# define COMPILER_ID "OpenWatcom"
+ /* __WATCOMC__ = VVRR + 1100 Open Watcom */
+# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100 ) / 100)
+# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
+# endif
#elif defined(__SUNPRO_C)
# define COMPILER_ID "SunPro"
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index 25ceb3f..e01794c 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -69,10 +69,17 @@
# 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__ = VVRR Watcom */
+# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
+# define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100)
+#else
+# define COMPILER_ID "OpenWatcom"
+ /* __WATCOMC__ = VVRR + 1100 Open Watcom */
+# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100 ) / 100)
+# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
+# endif
#elif defined(__SUNPRO_CC)
# define COMPILER_ID "SunPro"
diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake
index f83f992..0251eaf 100644
--- a/Modules/GenerateExportHeader.cmake
+++ b/Modules/GenerateExportHeader.cmake
@@ -220,7 +220,8 @@ macro(_test_compiler_hidden_visibility)
AND NOT CYGWIN
AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES XL
AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES PGI
- AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES Watcom)
+ AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES Watcom
+ AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES OpenWatcom)
check_cxx_compiler_flag(-fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY)
check_cxx_compiler_flag(-fvisibility-inlines-hidden
COMPILER_HAS_HIDDEN_INLINE_VISIBILITY)
@@ -235,7 +236,8 @@ macro(_test_compiler_has_deprecated)
OR "${CMAKE_CXX_COMPILER_ID}" MATCHES HP
OR GCC_TOO_OLD
OR "${CMAKE_CXX_COMPILER_ID}" MATCHES PGI
- OR "${CMAKE_CXX_COMPILER_ID}" MATCHES Watcom)
+ OR "${CMAKE_CXX_COMPILER_ID}" MATCHES Watcom
+ OR "${CMAKE_CXX_COMPILER_ID}" MATCHES OpenWatcom)
set(COMPILER_HAS_DEPRECATED "" CACHE INTERNAL
"Compiler support for a deprecated attribute")
else()
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake
index 7e68e8f..62af377 100644
--- a/Modules/InstallRequiredSystemLibraries.cmake
+++ b/Modules/InstallRequiredSystemLibraries.cmake
@@ -368,16 +368,17 @@ if(WATCOM)
get_filename_component( CompilerPath ${CMAKE_C_COMPILER} PATH )
if(CMAKE_C_COMPILER_VERSION)
set(_compiler_version ${CMAKE_C_COMPILER_VERSION})
+ set(_compiler_id ${CMAKE_C_COMPILER_ID})
else()
set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
+ set(_compiler_id ${CMAKE_CXX_COMPILER_ID})
endif()
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")
+ if(_compiler_id MATCHES "Watcom")
+ math(EXPR _watcom_minor "${_watcom_minor} / 10")
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..7aecf0a 100644
--- a/Modules/Platform/Windows-wcl386.cmake
+++ b/Modules/Platform/Windows-wcl386.cmake
@@ -86,23 +86,27 @@ if(NOT _CMAKE_WATCOM_VERSION)
set(_CMAKE_WATCOM_VERSION 1)
if(CMAKE_C_COMPILER_VERSION)
set(_compiler_version ${CMAKE_C_COMPILER_VERSION})
+ set(_compiler_id ${CMAKE_C_COMPILER_ID})
else()
set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
+ set(_compiler_id ${CMAKE_CXX_COMPILER_ID})
endif()
set(WATCOM16)
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}" 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()
endif()
endif()
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index dba2406..e99bf04 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -715,7 +715,7 @@ std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf)
{
compiler = "icc";
}
- else if (compilerId == "Watcom")
+ else if (compilerId == "Watcom" || compilerId == "OpenWatcom")
{
compiler = "ow";
}
diff --git a/Tests/Module/GenerateExportHeader/CMakeLists.txt b/Tests/Module/GenerateExportHeader/CMakeLists.txt
index bf867a9..07c37d3 100644
--- a/Tests/Module/GenerateExportHeader/CMakeLists.txt
+++ b/Tests/Module/GenerateExportHeader/CMakeLists.txt
@@ -3,7 +3,8 @@ cmake_minimum_required(VERSION 2.8.5 FATAL_ERROR)
project(GenerateExportHeader)
# Prevent timeout on Watcom by not running the tests.
-if ("${CMAKE_CXX_COMPILER_ID}" MATCHES Watcom)
+if ("${CMAKE_CXX_COMPILER_ID}" MATCHES Watcom
+ OR "${CMAKE_CXX_COMPILER_ID}" MATCHES OpenWatcom)
file(WRITE
"${CMAKE_CURRENT_BINARY_DIR}/main.cxx"
"int main() { return 0; }
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 499d12b..b0072b3 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -58,6 +58,7 @@ if(NOT WIN32)
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES Watcom
+ OR CMAKE_CXX_COMPILER_ID MATCHES OpenWatcom
OR CMAKE_SYSTEM_NAME MATCHES IRIX64
OR CMAKE_CXX_COMPILER_ID MATCHES HP
OR CMAKE_CXX_COMPILER_ID MATCHES XL
--
1.7.11.msysgit.0
>From 94fcc46d6f3f2f4c3291cfa32a2bd800365f2a98 Mon Sep 17 00:00:00 2001
From: Jiri Malak <[email protected]>
Date: Fri, 14 Mar 2014 19:14:15 +0100
Subject: [PATCH 2/2] Fill ARCHITECTURE_ID and PLATFORM_ID for Open Watcom
compilers
---
Modules/CMakePlatformId.h.in | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
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
--
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