diff options
author | Brad King <brad.king@kitware.com> | 2020-04-29 11:31:00 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-04-29 11:31:11 (GMT) |
commit | d968ec380b1cc0f26a24924a8228474d62f23267 (patch) | |
tree | da279e6bcf5fc843fac17e16cec9c2ae95572854 /Modules | |
parent | c9fdee6a6753c13acfdc3da439f1e597e6cf645c (diff) | |
parent | d3640dbdd576eaa9091f36f4a0b1bb981518ced9 (diff) | |
download | CMake-d968ec380b1cc0f26a24924a8228474d62f23267.zip CMake-d968ec380b1cc0f26a24924a8228474d62f23267.tar.gz CMake-d968ec380b1cc0f26a24924a8228474d62f23267.tar.bz2 |
Merge topic 'openwatcom-platform-independence'
d3640dbdd5 OpenWatcom: Organize and update C/C++ toolchain command lines
7aa9e89b1c OpenWatcom: Move non-Windows settings to Modules/Compiler
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4666
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/Compiler/OpenWatcom-C.cmake | 1 | ||||
-rw-r--r-- | Modules/Compiler/OpenWatcom-CXX.cmake | 1 | ||||
-rw-r--r-- | Modules/Compiler/OpenWatcom.cmake | 118 | ||||
-rw-r--r-- | Modules/Platform/Windows-OpenWatcom.cmake | 112 |
4 files changed, 123 insertions, 109 deletions
diff --git a/Modules/Compiler/OpenWatcom-C.cmake b/Modules/Compiler/OpenWatcom-C.cmake new file mode 100644 index 0000000..19e3359 --- /dev/null +++ b/Modules/Compiler/OpenWatcom-C.cmake @@ -0,0 +1 @@ +include(Compiler/OpenWatcom) diff --git a/Modules/Compiler/OpenWatcom-CXX.cmake b/Modules/Compiler/OpenWatcom-CXX.cmake new file mode 100644 index 0000000..19e3359 --- /dev/null +++ b/Modules/Compiler/OpenWatcom-CXX.cmake @@ -0,0 +1 @@ +include(Compiler/OpenWatcom) diff --git a/Modules/Compiler/OpenWatcom.cmake b/Modules/Compiler/OpenWatcom.cmake new file mode 100644 index 0000000..9efbfc2 --- /dev/null +++ b/Modules/Compiler/OpenWatcom.cmake @@ -0,0 +1,118 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# This module is shared by multiple languages; use include blocker. +include_guard() + +set(CMAKE_LIBRARY_PATH_FLAG "libpath ") +set(CMAKE_LINK_LIBRARY_FLAG "library ") +set(CMAKE_LINK_LIBRARY_FILE_FLAG "library ") + +if(CMAKE_VERBOSE_MAKEFILE) + set(CMAKE_WCL_QUIET) + set(CMAKE_WLINK_QUIET) + set(CMAKE_LIB_QUIET) +else() + set(CMAKE_WCL_QUIET "-zq") + set(CMAKE_WLINK_QUIET "option quiet") + set(CMAKE_LIB_QUIET "-q") +endif() + +foreach(type CREATE_SHARED_LIBRARY CREATE_SHARED_MODULE LINK_EXECUTABLE) + set(CMAKE_C_${type}_USE_WATCOM_QUOTE 1) + set(CMAKE_CXX_${type}_USE_WATCOM_QUOTE 1) +endforeach() + +foreach(type SHARED MODULE EXE) + # linker map file creation directives + string(APPEND CMAKE_${type}_LINKER_FLAGS_INIT " opt map") + # linker debug directives + string(APPEND CMAKE_${type}_LINKER_FLAGS_DEBUG_INIT " debug all") + string(APPEND CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO_INIT " debug all") +endforeach() + +foreach(lang C CXX) + # warning level + string(APPEND CMAKE_${lang}_FLAGS_INIT " -w3") + # debug options + string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -d2") + string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -s -os -d0 -dNDEBUG") + string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -s -ot -d0 -dNDEBUG") + string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -s -ot -d1 -dNDEBUG") +endforeach() + +# C create import library +set(CMAKE_C_CREATE_IMPORT_LIBRARY + "wlib -c -q -n -b <TARGET_IMPLIB> +<TARGET_QUOTED>") +# C++ create import library +set(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY}) + +# C link a object files into an executable file +set(CMAKE_C_LINK_EXECUTABLE + "wlink ${CMAKE_WLINK_QUIET} name <TARGET> <LINK_FLAGS> file {<OBJECTS>} <LINK_LIBRARIES>") +# C++ link a object files into an executable file +set(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE}) + +# C compile a file into an object file +set(CMAKE_C_COMPILE_OBJECT + "<CMAKE_C_COMPILER> ${CMAKE_WCL_QUIET} -d+ <DEFINES> <INCLUDES> <FLAGS> -fo<OBJECT> -c -cc <SOURCE>") +# C++ compile a file into an object file +set(CMAKE_CXX_COMPILE_OBJECT + "<CMAKE_CXX_COMPILER> ${CMAKE_WCL_QUIET} -d+ <DEFINES> <INCLUDES> <FLAGS> -fo<OBJECT> -c -cc++ <SOURCE>") + +# C preprocess a source file +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE + "<CMAKE_C_COMPILER> ${CMAKE_WCL_QUIET} -d+ <DEFINES> <INCLUDES> <FLAGS> -fo<PREPROCESSED_SOURCE> -pl -cc <SOURCE>") +# C++ preprocess a source file +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE + "<CMAKE_CXX_COMPILER> ${CMAKE_WCL_QUIET} -d+ <DEFINES> <INCLUDES> <FLAGS> -fo<PREPROCESSED_SOURCE> -pl -cc++ <SOURCE>") + +# C create a shared library +set(CMAKE_C_CREATE_SHARED_LIBRARY + "wlink ${CMAKE_WLINK_QUIET} name <TARGET> <LINK_FLAGS> option implib=<TARGET_IMPLIB> file {<OBJECTS>} <LINK_LIBRARIES>") +# C++ create a shared library +set(CMAKE_CXX_CREATE_SHARED_LIBRARY ${CMAKE_C_CREATE_SHARED_LIBRARY}) + +# C create a shared module +set(CMAKE_C_CREATE_SHARED_MODULE + "wlink ${CMAKE_WLINK_QUIET} name <TARGET> <LINK_FLAGS> file {<OBJECTS>} <LINK_LIBRARIES>") +# C++ create a shared module +set(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_C_CREATE_SHARED_MODULE}) + +# C create a static library +set(CMAKE_C_CREATE_STATIC_LIBRARY + "wlib ${CMAKE_LIB_QUIET} -c -n -b <TARGET_QUOTED> <LINK_FLAGS> <OBJECTS> ") +# C++ create a static library +set(CMAKE_CXX_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY}) + + +# old CMake internaly used OpenWatcom version macros +# for backward compatibility +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_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() diff --git a/Modules/Platform/Windows-OpenWatcom.cmake b/Modules/Platform/Windows-OpenWatcom.cmake index 76cd28b..4c0e57e 100644 --- a/Modules/Platform/Windows-OpenWatcom.cmake +++ b/Modules/Platform/Windows-OpenWatcom.cmake @@ -1,36 +1,13 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. - # This module is shared by multiple languages; use include blocker. -if(__WINDOWS_OPENWATCOM) - return() -endif() -set(__WINDOWS_OPENWATCOM 1) - -set(CMAKE_LIBRARY_PATH_FLAG "libpath ") -set(CMAKE_LINK_LIBRARY_FLAG "library ") -set(CMAKE_LINK_LIBRARY_FILE_FLAG "library ") - -if(CMAKE_VERBOSE_MAKEFILE) - set(CMAKE_WCL_QUIET) - set(CMAKE_WLINK_QUIET) - set(CMAKE_LIB_QUIET) -else() - set(CMAKE_WCL_QUIET "-zq") - set(CMAKE_WLINK_QUIET "option quiet") - set(CMAKE_LIB_QUIET "-q") -endif() +include_guard() -string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ") set(CMAKE_CREATE_WIN32_EXE "system nt_win" ) set(CMAKE_CREATE_CONSOLE_EXE "system nt" ) string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " system nt_dll") string(APPEND CMAKE_MODULE_LINKER_FLAGS_INIT " system nt_dll") -foreach(type SHARED MODULE EXE) - string(APPEND CMAKE_${type}_LINKER_FLAGS_DEBUG_INIT " debug all opt map") - string(APPEND CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO_INIT " debug all opt map") -endforeach() 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. @@ -42,88 +19,5 @@ set(CMAKE_BUILD_TYPE_INIT Debug) # 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 -w3 -dWIN32 -br -bm") -string(APPEND CMAKE_CXX_FLAGS_INIT " -bt=nt -xs -w3 -dWIN32 -br -bm") -foreach(lang C CXX) - string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -d2") - string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -s -os -d0 -dNDEBUG") - string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -s -ot -d0 -dNDEBUG") - string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -s -ot -d1 -dNDEBUG") -endforeach() - -foreach(type CREATE_SHARED_LIBRARY CREATE_SHARED_MODULE LINK_EXECUTABLE) - set(CMAKE_C_${type}_USE_WATCOM_QUOTE 1) - set(CMAKE_CXX_${type}_USE_WATCOM_QUOTE 1) -endforeach() - -set(CMAKE_C_CREATE_IMPORT_LIBRARY - "wlib -c -q -n -b <TARGET_IMPLIB> +<TARGET_QUOTED>") -set(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY}) - -set(CMAKE_C_LINK_EXECUTABLE - "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name <TARGET> <LINK_FLAGS> file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") - - -set(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE}) - -# compile a C++ file into an object file -set(CMAKE_CXX_COMPILE_OBJECT - "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ <DEFINES> <INCLUDES> <FLAGS> -fo<OBJECT> -c -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}") - -# compile a C file into an object file -set(CMAKE_C_COMPILE_OBJECT - "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ <DEFINES> <INCLUDES> <FLAGS> -fo<OBJECT> -c -cc <SOURCE>${CMAKE_END_TEMP_FILE}") - -# preprocess a C source file -set(CMAKE_C_CREATE_PREPROCESSED_SOURCE - "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ <DEFINES> <INCLUDES> <FLAGS> -fo<PREPROCESSED_SOURCE> -pl -cc <SOURCE>${CMAKE_END_TEMP_FILE}") - -# preprocess a C++ source file -set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE - "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ <DEFINES> <INCLUDES> <FLAGS> -fo<PREPROCESSED_SOURCE> -pl -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}") - -set(CMAKE_CXX_CREATE_SHARED_LIBRARY - "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name <TARGET> <LINK_FLAGS> option implib=<TARGET_IMPLIB> file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") -string(REPLACE " option implib=<TARGET_IMPLIB>" "" - CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") - -# create a C shared library -set(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) - -# create a C shared module -set(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_MODULE}) - -# create a C++ static library -set(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -c -n -b <TARGET_QUOTED> <LINK_FLAGS> <OBJECTS> ") - -# create a C static library -set(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY}) - -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_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() +string(APPEND CMAKE_C_FLAGS_INIT " -bt=nt -dWIN32 -br -bm") +string(APPEND CMAKE_CXX_FLAGS_INIT " -bt=nt -xs -dWIN32 -br -bm") |