summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCameron Cawley <ccawley2011@gmail.com>2022-04-17 12:12:57 (GMT)
committerBrad King <brad.king@kitware.com>2022-05-06 14:40:59 (GMT)
commit6a2b016bbd35f5843cc95e36431928fd0905a61c (patch)
treeb1d8b95203bb5729f2d8e025667d253cfe7c766a
parent33da5824acefcb4106ce89fc2278111dc3846c0a (diff)
downloadCMake-6a2b016bbd35f5843cc95e36431928fd0905a61c.zip
CMake-6a2b016bbd35f5843cc95e36431928fd0905a61c.tar.gz
CMake-6a2b016bbd35f5843cc95e36431928fd0905a61c.tar.bz2
OpenWatcom: Support CMAKE_WATCOM_RUNTIME_LIBRARY with Linux and OS/2 builds
-rw-r--r--Help/policy/CMP0136.rst3
-rw-r--r--Help/prop_tgt/WATCOM_RUNTIME_LIBRARY-VALUES.txt6
-rw-r--r--Help/prop_tgt/WATCOM_RUNTIME_LIBRARY.rst3
-rw-r--r--Help/variable/CMAKE_WATCOM_RUNTIME_LIBRARY.rst4
-rw-r--r--Modules/Platform/Linux-OpenWatcom-C.cmake1
-rw-r--r--Modules/Platform/Linux-OpenWatcom-CXX.cmake1
-rw-r--r--Modules/Platform/Linux-OpenWatcom.cmake13
-rw-r--r--Modules/Platform/OS2-OpenWatcom-C.cmake1
-rw-r--r--Modules/Platform/OS2-OpenWatcom-CXX.cmake1
-rw-r--r--Modules/Platform/OS2-OpenWatcom.cmake15
10 files changed, 42 insertions, 6 deletions
diff --git a/Help/policy/CMP0136.rst b/Help/policy/CMP0136.rst
index 4a718e9..5414278 100644
--- a/Help/policy/CMP0136.rst
+++ b/Help/policy/CMP0136.rst
@@ -22,7 +22,8 @@ out of the default :variable:`CMAKE_<LANG>_FLAGS_<CONFIG>` values and instead
offer a first-class abstraction. The :variable:`CMAKE_WATCOM_RUNTIME_LIBRARY`
variable and :prop_tgt:`WATCOM_RUNTIME_LIBRARY` target property may be set to
select the Watcom runtime library. If they are not set then CMake uses the
-default value ``MultiThreadedDLL`` which is equivalent to the original flags.
+default value ``MultiThreadedDLL`` on Windows and ``SingleThreaded`` on other
+platforms, which is equivalent to the original flags.
This policy provides compatibility with projects that have not been updated
to be aware of the abstraction. The policy setting takes effect as of the
diff --git a/Help/prop_tgt/WATCOM_RUNTIME_LIBRARY-VALUES.txt b/Help/prop_tgt/WATCOM_RUNTIME_LIBRARY-VALUES.txt
index c29d73e..cdf99d0 100644
--- a/Help/prop_tgt/WATCOM_RUNTIME_LIBRARY-VALUES.txt
+++ b/Help/prop_tgt/WATCOM_RUNTIME_LIBRARY-VALUES.txt
@@ -3,13 +3,15 @@
statically-linked runtime library.
``SingleThreadedDLL``
Compile with ``-br`` or equivalent flag(s) to use a single-threaded
- dynamically-linked runtime library.
+ dynamically-linked runtime library. This is not available for Linux
+ targets.
``MultiThreaded``
Compile with ``-bm`` or equivalent flag(s) to use a multi-threaded
statically-linked runtime library.
``MultiThreadedDLL``
Compile with ``-bm -br`` or equivalent flag(s) to use a multi-threaded
- dynamically-linked runtime library.
+ dynamically-linked runtime library. This is not available for Linux
+ targets.
The value is ignored on non-Watcom compilers but an unsupported value will
be rejected as an error when using a compiler targeting the Watcom ABI.
diff --git a/Help/prop_tgt/WATCOM_RUNTIME_LIBRARY.rst b/Help/prop_tgt/WATCOM_RUNTIME_LIBRARY.rst
index 9f031fa..3752862 100644
--- a/Help/prop_tgt/WATCOM_RUNTIME_LIBRARY.rst
+++ b/Help/prop_tgt/WATCOM_RUNTIME_LIBRARY.rst
@@ -24,7 +24,8 @@ selects for the target ``foo`` a multi-threaded statically-linked runtime
library.
If this property is not set then CMake uses the default value
-``MultiThreadedDLL`` to select a Watcom runtime library.
+``MultiThreadedDLL`` on Windows and ``SingleThreaded`` on other
+platforms to select a Watcom runtime library.
.. note::
diff --git a/Help/variable/CMAKE_WATCOM_RUNTIME_LIBRARY.rst b/Help/variable/CMAKE_WATCOM_RUNTIME_LIBRARY.rst
index 979a533..feb2a60 100644
--- a/Help/variable/CMAKE_WATCOM_RUNTIME_LIBRARY.rst
+++ b/Help/variable/CMAKE_WATCOM_RUNTIME_LIBRARY.rst
@@ -26,8 +26,8 @@ library.
If this variable is not set then the :prop_tgt:`WATCOM_RUNTIME_LIBRARY` target
property will not be set automatically. If that property is not set then
-CMake uses the default value ``MultiThreadedDLL`` to select a Watcom runtime
-library.
+CMake uses the default value ``MultiThreadedDLL`` on Windows and
+``SingleThreaded`` on other platforms to select a Watcom runtime library.
.. note::
diff --git a/Modules/Platform/Linux-OpenWatcom-C.cmake b/Modules/Platform/Linux-OpenWatcom-C.cmake
index 383349a..7236c74 100644
--- a/Modules/Platform/Linux-OpenWatcom-C.cmake
+++ b/Modules/Platform/Linux-OpenWatcom-C.cmake
@@ -1 +1,2 @@
include(Platform/Linux-OpenWatcom)
+__linux_open_watcom(C)
diff --git a/Modules/Platform/Linux-OpenWatcom-CXX.cmake b/Modules/Platform/Linux-OpenWatcom-CXX.cmake
index 383349a..a5f386b 100644
--- a/Modules/Platform/Linux-OpenWatcom-CXX.cmake
+++ b/Modules/Platform/Linux-OpenWatcom-CXX.cmake
@@ -1 +1,2 @@
include(Platform/Linux-OpenWatcom)
+__linux_open_watcom(CXX)
diff --git a/Modules/Platform/Linux-OpenWatcom.cmake b/Modules/Platform/Linux-OpenWatcom.cmake
index 5b4e995..678d373 100644
--- a/Modules/Platform/Linux-OpenWatcom.cmake
+++ b/Modules/Platform/Linux-OpenWatcom.cmake
@@ -10,6 +10,14 @@ string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " system linux opt noextension")
string(APPEND CMAKE_MODULE_LINKER_FLAGS_INIT " system linux")
string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " system linux")
+cmake_policy(GET CMP0136 __LINUX_WATCOM_CMP0136)
+if(__LINUX_WATCOM_CMP0136 STREQUAL "NEW")
+ set(CMAKE_WATCOM_RUNTIME_LIBRARY_DEFAULT "SingleThreaded")
+else()
+ set(CMAKE_WATCOM_RUNTIME_LIBRARY_DEFAULT "")
+endif()
+unset(__LINUX_WATCOM_CMP0136)
+
# single/multi-threaded /-bm
# default is setup for single-threaded libraries
string(APPEND CMAKE_C_FLAGS_INIT " -bt=linux")
@@ -23,3 +31,8 @@ if(CMAKE_CROSSCOMPILING)
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES $ENV{WATCOM}/lh)
endif()
endif()
+
+macro(__linux_open_watcom lang)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_WATCOM_RUNTIME_LIBRARY_SingleThreaded "")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_WATCOM_RUNTIME_LIBRARY_MultiThreaded -bm)
+endmacro()
diff --git a/Modules/Platform/OS2-OpenWatcom-C.cmake b/Modules/Platform/OS2-OpenWatcom-C.cmake
index 21a4d9e..a6a6b78 100644
--- a/Modules/Platform/OS2-OpenWatcom-C.cmake
+++ b/Modules/Platform/OS2-OpenWatcom-C.cmake
@@ -1 +1,2 @@
include(Platform/OS2-OpenWatcom)
+__os2_open_watcom(C)
diff --git a/Modules/Platform/OS2-OpenWatcom-CXX.cmake b/Modules/Platform/OS2-OpenWatcom-CXX.cmake
index 21a4d9e..846bb29 100644
--- a/Modules/Platform/OS2-OpenWatcom-CXX.cmake
+++ b/Modules/Platform/OS2-OpenWatcom-CXX.cmake
@@ -1 +1,2 @@
include(Platform/OS2-OpenWatcom)
+__os2_open_watcom(CXX)
diff --git a/Modules/Platform/OS2-OpenWatcom.cmake b/Modules/Platform/OS2-OpenWatcom.cmake
index 998fb9f..720b953 100644
--- a/Modules/Platform/OS2-OpenWatcom.cmake
+++ b/Modules/Platform/OS2-OpenWatcom.cmake
@@ -16,6 +16,14 @@ endif()
set(CMAKE_C_COMPILE_OPTIONS_DLL "-bd") # Note: This variable is a ';' separated list
set(CMAKE_SHARED_LIBRARY_C_FLAGS "-bd") # ... while this is a space separated string.
+cmake_policy(GET CMP0136 __OS2_WATCOM_CMP0136)
+if(__OS2_WATCOM_CMP0136 STREQUAL "NEW")
+ set(CMAKE_WATCOM_RUNTIME_LIBRARY_DEFAULT "SingleThreaded")
+else()
+ set(CMAKE_WATCOM_RUNTIME_LIBRARY_DEFAULT "")
+endif()
+unset(__OS2_WATCOM_CMP0136)
+
string(APPEND CMAKE_C_FLAGS_INIT " -bt=os2")
string(APPEND CMAKE_CXX_FLAGS_INIT " -bt=os2 -xs")
@@ -33,3 +41,10 @@ if(NOT CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES)
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES $ENV{WATCOM}/h $ENV{WATCOM}/h/os2)
endif()
endif()
+
+macro(__os2_open_watcom lang)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_WATCOM_RUNTIME_LIBRARY_SingleThreaded "")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_WATCOM_RUNTIME_LIBRARY_SingleThreadedDLL -br)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_WATCOM_RUNTIME_LIBRARY_MultiThreaded -bm)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_WATCOM_RUNTIME_LIBRARY_MultiThreadedDLL -bm -br)
+endmacro()