Add Watcom support to InstallRequiredSystemLibraries (#11866)

Also adds code to determine the version of the Watcom compiler
in use.

Thanks to J Decker for the patch.
This commit is contained in:
David Cole 2011-07-29 13:28:54 -04:00
parent 5ef20b2dc5
commit 80769cdd1e
3 changed files with 73 additions and 0 deletions

View File

@ -0,0 +1 @@
VERSION=__WATCOMC__

View File

@ -330,6 +330,40 @@ IF(MSVC)
ENDFOREACH(lib) ENDFOREACH(lib)
ENDIF(MSVC) ENDIF(MSVC)
IF(WATCOM)
GET_FILENAME_COMPONENT( CompilerPath ${CMAKE_C_COMPILER} PATH )
IF(WATCOM17)
SET( __install__libs ${CompilerPath}/clbr17.dll
${CompilerPath}/mt7r17.dll ${CompilerPath}/plbr17.dll )
ENDIF()
IF(WATCOM18)
SET( __install__libs ${CompilerPath}/clbr18.dll
${CompilerPath}/mt7r18.dll ${CompilerPath}/plbr18.dll )
ENDIF()
IF(WATCOM19)
SET( __install__libs ${CompilerPath}/clbr19.dll
${CompilerPath}/mt7r19.dll ${CompilerPath}/plbr19.dll )
ENDIF()
FOREACH(lib
${__install__libs}
)
IF(EXISTS ${lib})
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} ${lib})
ELSE()
IF(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
MESSAGE(WARNING "system runtime library file does not exist: '${lib}'")
# This warning indicates an incomplete Watcom installation
# or a bug somewhere above here in this file.
# If you would like to avoid this warning, fix the real problem, or
# set CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS before including
# this file.
ENDIF()
ENDIF()
ENDFOREACH()
ENDIF()
# Include system runtime libraries in the installation if any are # Include system runtime libraries in the installation if any are
# specified by CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS. # specified by CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS.
IF(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS) IF(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS)

View File

@ -81,3 +81,41 @@ SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -n -b '<TARGET_UNQ
# create a C static library # create a C static library
SET(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY}) SET(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY})
IF(NOT CMAKE_WATCOM_COMPILER_TESTS_RUN)
SET(CMAKE_WATCOM_COMPILER_TESTS_RUN 1)
SET(testWatcomVersionFile
"${CMAKE_ROOT}/Modules/CMakeTestWatcomVersion.c")
STRING(REGEX REPLACE "/" "\\\\" testWatcomVersionFile "${testWatcomVersionFile}")
MESSAGE(STATUS "Check for Watcom compiler version")
SET(CMAKE_TEST_COMPILER ${CMAKE_C_COMPILER})
IF (NOT CMAKE_C_COMPILER)
SET(CMAKE_TEST_COMPILER ${CMAKE_CXX_COMPILER})
ENDIF()
EXECUTE_PROCESS(COMMAND ${CMAKE_TEST_COMPILER}
-q -pc \"${testWatcomVersionFile}\"
OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT
RETURN_VALUE CMAKE_COMPILER_RETURN
)
STRING(REGEX REPLACE "\n" " " compilerVersion "${CMAKE_COMPILER_OUTPUT}")
STRING(REGEX REPLACE ".*VERSION=(.*)" "\\1"
compilerVersion "${compilerVersion}")
IF(NOT CMAKE_COMPILER_RETURN)
SET(WATCOM16)
SET(WATCOM17)
SET(WATCOM18)
SET(WATCOM19)
IF("${compilerVersion}" LESS 1270)
SET(WATCOM16 1)
ENDIF()
IF("${compilerVersion}" EQUAL 1270)
SET(WATCOM17 1)
ENDIF()
IF("${compilerVersion}" EQUAL 1280)
SET(WATCOM18 1)
ENDIF()
IF("${compilerVersion}" EQUAL 1290)
SET(WATCOM19 1)
ENDIF()
ENDIF()
ENDIF()