diff options
author | Cameron Cawley <ccawley2011@gmail.com> | 2021-10-18 22:20:07 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-05-06 14:40:58 (GMT) |
commit | 33da5824acefcb4106ce89fc2278111dc3846c0a (patch) | |
tree | ee90b8f17abb3948ab3f3cc1fe592c4f24bcdbcd /Modules/Platform/Windows-OpenWatcom.cmake | |
parent | 849ad97d9576697b180547d8d850b59e7100c6c0 (diff) | |
download | CMake-33da5824acefcb4106ce89fc2278111dc3846c0a.zip CMake-33da5824acefcb4106ce89fc2278111dc3846c0a.tar.gz CMake-33da5824acefcb4106ce89fc2278111dc3846c0a.tar.bz2 |
OpenWatcom: Allow specifying the runtime library
Add a `CMAKE_WATCOM_RUNTIME_LIBRARY` variable to control the
runtime library selection. Add policy CMP0136 to switch to
in place of the old hard-coded default flags.
Fixes: #23178
Diffstat (limited to 'Modules/Platform/Windows-OpenWatcom.cmake')
-rw-r--r-- | Modules/Platform/Windows-OpenWatcom.cmake | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/Modules/Platform/Windows-OpenWatcom.cmake b/Modules/Platform/Windows-OpenWatcom.cmake index 19bcb97..657a923 100644 --- a/Modules/Platform/Windows-OpenWatcom.cmake +++ b/Modules/Platform/Windows-OpenWatcom.cmake @@ -14,11 +14,20 @@ set(CMAKE_SHARED_LIBRARY_C_FLAGS "-bd") # ... while this is a space separated st set(CMAKE_RC_COMPILER "rc" ) -# single/multi-threaded /-bm -# static/DLL run-time libraries /-br -# default is setup for multi-threaded + DLL run-time libraries -string(APPEND CMAKE_C_FLAGS_INIT " -bt=nt -dWIN32 -br -bm") -string(APPEND CMAKE_CXX_FLAGS_INIT " -bt=nt -xs -dWIN32 -br -bm") +cmake_policy(GET CMP0136 __WINDOWS_WATCOM_CMP0136) +if(__WINDOWS_WATCOM_CMP0136 STREQUAL "NEW") + set(CMAKE_WATCOM_RUNTIME_LIBRARY_DEFAULT "MultiThreadedDLL") + set(_br_bm "") +else() + set(CMAKE_WATCOM_RUNTIME_LIBRARY_DEFAULT "") + set(_br_bm "-br -bm") +endif() + +string(APPEND CMAKE_C_FLAGS_INIT " -bt=nt -dWIN32 ${_br_bm}") +string(APPEND CMAKE_CXX_FLAGS_INIT " -bt=nt -xs -dWIN32 ${_br_bm}") + +unset(__WINDOWS_WATCOM_CMP0136) +unset(_br_bm) if(CMAKE_CROSSCOMPILING) if(NOT CMAKE_C_STANDARD_INCLUDE_DIRECTORIES) @@ -32,4 +41,9 @@ endif() macro(__windows_open_watcom lang) set(CMAKE_${lang}_CREATE_WIN32_EXE "system nt_win") set(CMAKE_${lang}_CREATE_CONSOLE_EXE "system nt") + + 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() |