diff options
author | Brad King <brad.king@kitware.com> | 2014-04-15 14:22:34 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-04-15 14:22:34 (GMT) |
commit | 18aaed77c0eb4ea81e02ece5d0be0525e4460828 (patch) | |
tree | b9edac325fd6d09118b15aca5d8b2d82a1f76ab1 /Modules/CMakeDetermineCompilerId.cmake | |
parent | 60d1882a67a550c0fbe11e2462669830c89ee89e (diff) | |
parent | f21ac16edd0d2fbe78daf17bf5f964e4cfbd694b (diff) | |
download | CMake-18aaed77c0eb4ea81e02ece5d0be0525e4460828.zip CMake-18aaed77c0eb4ea81e02ece5d0be0525e4460828.tar.gz CMake-18aaed77c0eb4ea81e02ece5d0be0525e4460828.tar.bz2 |
Merge topic 'matches-cleanup'
f21ac16e Replace MATCHES test on numbers with EQUAL test
7eacbaed Replace MATCHES ".+" tests with NOT STREQUAL ""
3a71d34c Use CMAKE_SYSTEM_NAME instead of CMAKE_SYSTEM where sufficient
b0b4b460 Remove .* expressions from beginning and end of MATCHES regexs
5bd48ac5 Replace string(REGEX REPLACE) with string(REPLACE) where possible
2622bc3f Clean up usage of if(... MATCHES regex) followed string(REGEX REPLACE regex)
Diffstat (limited to 'Modules/CMakeDetermineCompilerId.cmake')
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 067892d..f109dc4 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -27,7 +27,7 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) else() set(CMAKE_${lang}_COMPILER_ID_FLAGS $ENV{${flagvar}}) endif() - string(REGEX REPLACE " " ";" CMAKE_${lang}_COMPILER_ID_FLAGS_LIST "${CMAKE_${lang}_COMPILER_ID_FLAGS}") + string(REPLACE " " ";" CMAKE_${lang}_COMPILER_ID_FLAGS_LIST "${CMAKE_${lang}_COMPILER_ID_FLAGS}") # Compute the directory in which to run the test. set(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_PLATFORM_INFO_DIR}/CompilerId${lang}) @@ -356,35 +356,30 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 6 REGEX "INFO:") set(COMPILER_ID_TWICE) foreach(info ${CMAKE_${lang}_COMPILER_ID_STRINGS}) - if("${info}" MATCHES ".*INFO:compiler\\[([^]\"]*)\\].*") + if("${info}" MATCHES "INFO:compiler\\[([^]\"]*)\\]") if(COMPILER_ID) set(COMPILER_ID_TWICE 1) endif() - string(REGEX REPLACE ".*INFO:compiler\\[([^]]*)\\].*" "\\1" - COMPILER_ID "${info}") + set(COMPILER_ID "${CMAKE_MATCH_1}") endif() - if("${info}" MATCHES ".*INFO:platform\\[([^]\"]*)\\].*") - string(REGEX REPLACE ".*INFO:platform\\[([^]]*)\\].*" "\\1" - PLATFORM_ID "${info}") + if("${info}" MATCHES "INFO:platform\\[([^]\"]*)\\]") + set(PLATFORM_ID "${CMAKE_MATCH_1}") endif() - if("${info}" MATCHES ".*INFO:arch\\[([^]\"]*)\\].*") - string(REGEX REPLACE ".*INFO:arch\\[([^]]*)\\].*" "\\1" - ARCHITECTURE_ID "${info}") + if("${info}" MATCHES "INFO:arch\\[([^]\"]*)\\]") + set(ARCHITECTURE_ID "${CMAKE_MATCH_1}") endif() - if("${info}" MATCHES ".*INFO:compiler_version\\[([^]\"]*)\\].*") - string(REGEX REPLACE ".*INFO:compiler_version\\[([^]]*)\\].*" "\\1" COMPILER_VERSION "${info}") - string(REGEX REPLACE "^0+([0-9])" "\\1" COMPILER_VERSION "${COMPILER_VERSION}") + if("${info}" MATCHES "INFO:compiler_version\\[([^]\"]*)\\]") + string(REGEX REPLACE "^0+([0-9])" "\\1" COMPILER_VERSION "${CMAKE_MATCH_1}") string(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION "${COMPILER_VERSION}") endif() - if("${info}" MATCHES ".*INFO:simulate\\[([^]\"]*)\\].*") + if("${info}" MATCHES "INFO:simulate\\[([^]\"]*)\\]") set(SIMULATE_ID "${CMAKE_MATCH_1}") endif() - if("${info}" MATCHES ".*INFO:simulate_version\\[([^]\"]*)\\].*") - set(SIMULATE_VERSION "${CMAKE_MATCH_1}") - string(REGEX REPLACE "^0+([0-9])" "\\1" SIMULATE_VERSION "${SIMULATE_VERSION}") + if("${info}" MATCHES "INFO:simulate_version\\[([^]\"]*)\\]") + string(REGEX REPLACE "^0+([0-9])" "\\1" SIMULATE_VERSION "${CMAKE_MATCH_1}") string(REGEX REPLACE "\\.0+([0-9])" ".\\1" SIMULATE_VERSION "${SIMULATE_VERSION}") endif() - if("${info}" MATCHES ".*INFO:qnxnto") + if("${info}" MATCHES "INFO:qnxnto") set(COMPILER_QNXNTO 1) endif() endforeach() |