Merge topic 'watcom-compiler-version'

af42ae4 Watcom: Simplify compiler version detection (#11866)
This commit is contained in:
Brad King 2012-08-13 13:42:00 -04:00
commit be9db98946
1 changed files with 24 additions and 37 deletions

View File

@ -83,40 +83,27 @@ SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -c -n -b '<TARGET_
# create a C 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
RESULT_VARIABLE CMAKE_COMPILER_RETURN
)
STRING(REGEX REPLACE "\n" " " compilerVersion "${CMAKE_COMPILER_OUTPUT}")
STRING(REGEX REPLACE ".*VERSION=(.*)" "\\1"
compilerVersion "${compilerVersion}")
IF("${CMAKE_COMPILER_RETURN}" STREQUAL "0")
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()
if(NOT _CMAKE_WATCOM_VERSION)
set(_CMAKE_WATCOM_VERSION 1)
if(CMAKE_C_COMPILER_VERSION)
set(_compiler_version ${CMAKE_C_COMPILER_VERSION})
else()
set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
endif()
set(WATCOM16)
set(WATCOM17)
set(WATCOM18)
set(WATCOM19)
if("${_compiler_version}" LESS 12.70)
set(WATCOM16 1)
endif()
if("${_compiler_version}" EQUAL 12.70)
set(WATCOM17 1)
endif()
if("${_compiler_version}" EQUAL 12.80)
set(WATCOM18 1)
endif()
if("${_compiler_version}" EQUAL 12.90)
set(WATCOM19 1)
endif()
endif()