OpenWatcom: Support CMAKE_WATCOM_RUNTIME_LIBRARY with Linux and OS/2 builds

This commit is contained in:
Cameron Cawley
2022-04-17 13:12:57 +01:00
committed by Brad King
parent 33da5824ac
commit 6a2b016bbd
10 changed files with 42 additions and 6 deletions
@@ -1 +1,2 @@
include(Platform/Linux-OpenWatcom)
__linux_open_watcom(C)
@@ -1 +1,2 @@
include(Platform/Linux-OpenWatcom)
__linux_open_watcom(CXX)
+13
View File
@@ -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()
+1
View File
@@ -1 +1,2 @@
include(Platform/OS2-OpenWatcom)
__os2_open_watcom(C)
@@ -1 +1,2 @@
include(Platform/OS2-OpenWatcom)
__os2_open_watcom(CXX)
+15
View File
@@ -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()