diff options
author | Brad King <brad.king@kitware.com> | 2012-08-13 12:15:42 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-08-13 12:19:23 (GMT) |
commit | af42ae4f8190c5c0257703b04671f35e66dfaa05 (patch) | |
tree | d3367a36b9c12281edaaa89e4076b53075e54361 /Modules/Platform | |
parent | 408c04e7342ab4ee09b1243a2c460c797f7996cc (diff) | |
download | CMake-af42ae4f8190c5c0257703b04671f35e66dfaa05.zip CMake-af42ae4f8190c5c0257703b04671f35e66dfaa05.tar.gz CMake-af42ae4f8190c5c0257703b04671f35e66dfaa05.tar.bz2 |
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.
Diffstat (limited to 'Modules/Platform')
-rw-r--r-- | Modules/Platform/Windows-wcl386.cmake | 61 |
1 files changed, 24 insertions, 37 deletions
diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake index 14b3b81..21c4a69 100644 --- a/Modules/Platform/Windows-wcl386.cmake +++ b/Modules/Platform/Windows-wcl386.cmake @@ -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() |