Watcom: Simplify compiler version detection (#11866)

Since commit c198730b (Detect Watcom compiler version with its id,
2011-12-07) the CMAKE_(C|CXX)_COMPILER_VERSION variables are set for the
Watcom compiler.  Use these in Windows-wcl386.cmake to set the old
WATCOM1* version variables.  This avoids using the old EXECUTE_PROCESS
command which failed due to extra quotes anyway.
This commit is contained in:
Brad King 2012-08-13 08:15:42 -04:00
parent 408c04e734
commit af42ae4f81
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 # 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) if(NOT _CMAKE_WATCOM_VERSION)
SET(CMAKE_WATCOM_COMPILER_TESTS_RUN 1) set(_CMAKE_WATCOM_VERSION 1)
SET(testWatcomVersionFile if(CMAKE_C_COMPILER_VERSION)
"${CMAKE_ROOT}/Modules/CMakeTestWatcomVersion.c") set(_compiler_version ${CMAKE_C_COMPILER_VERSION})
STRING(REGEX REPLACE "/" "\\\\" testWatcomVersionFile "${testWatcomVersionFile}") else()
MESSAGE(STATUS "Check for Watcom compiler version") set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
SET(CMAKE_TEST_COMPILER ${CMAKE_C_COMPILER}) endif()
IF (NOT CMAKE_C_COMPILER) set(WATCOM16)
SET(CMAKE_TEST_COMPILER ${CMAKE_CXX_COMPILER}) set(WATCOM17)
ENDIF() set(WATCOM18)
EXECUTE_PROCESS(COMMAND ${CMAKE_TEST_COMPILER} set(WATCOM19)
-q -pc \"${testWatcomVersionFile}\" if("${_compiler_version}" LESS 12.70)
OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT set(WATCOM16 1)
RESULT_VARIABLE CMAKE_COMPILER_RETURN endif()
) if("${_compiler_version}" EQUAL 12.70)
STRING(REGEX REPLACE "\n" " " compilerVersion "${CMAKE_COMPILER_OUTPUT}") set(WATCOM17 1)
STRING(REGEX REPLACE ".*VERSION=(.*)" "\\1" endif()
compilerVersion "${compilerVersion}") if("${_compiler_version}" EQUAL 12.80)
IF("${CMAKE_COMPILER_RETURN}" STREQUAL "0") set(WATCOM18 1)
SET(WATCOM16) endif()
SET(WATCOM17) if("${_compiler_version}" EQUAL 12.90)
SET(WATCOM18) set(WATCOM19 1)
SET(WATCOM19) endif()
IF("${compilerVersion}" LESS 1270) endif()
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()