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 /Tests | |
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 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/CMakeTests/CheckCMakeTest.cmake | 4 | ||||
-rw-r--r-- | Tests/CMakeTests/ExecuteScriptTests.cmake | 4 | ||||
-rw-r--r-- | Tests/CTestUpdateCommon.cmake | 4 | ||||
-rw-r--r-- | Tests/Complex/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/ComplexOneConfig/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/CustomCommand/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/FindPackageModeMakefileTest/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/PerConfig/perconfig.cmake | 2 | ||||
-rw-r--r-- | Tests/SubDirSpaces/CMakeLists.txt | 2 |
10 files changed, 17 insertions, 17 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 0e60ed1..7d4e8b4 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -798,7 +798,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set(CTEST_package_X11_TEST ${CTEST_TEST_CPACK}) set(CTEST_RUN_CPackComponentsForAll ${CTEST_TEST_CPACK}) - if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT CMAKE_CURRENT_BINARY_DIR MATCHES ".* .*") + if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT CMAKE_CURRENT_BINARY_DIR MATCHES " ") find_program(RPMBUILD NAMES rpmbuild) endif() # Do not try to build RPM @@ -899,7 +899,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release if(APPLE) list(APPEND GENLST "DragNDrop") endif() - if (NOT CMAKE_CURRENT_BINARY_DIR MATCHES ".* .*") + if (NOT CMAKE_CURRENT_BINARY_DIR MATCHES " ") list(FIND ACTIVE_CPACK_GENERATORS "RPM" RPM_ACTIVE) if (NOT ${RPM_ACTIVE} EQUAL -1) list(APPEND GENLST "RPM") diff --git a/Tests/CMakeTests/CheckCMakeTest.cmake b/Tests/CMakeTests/CheckCMakeTest.cmake index 7be7b30..1565394 100644 --- a/Tests/CMakeTests/CheckCMakeTest.cmake +++ b/Tests/CMakeTests/CheckCMakeTest.cmake @@ -9,8 +9,8 @@ function(check_cmake_test_single prefix test testfile) ERROR_VARIABLE stderr RESULT_VARIABLE result ) - string(REGEX REPLACE "\n" "\n out> " out " out> ${stdout}") - string(REGEX REPLACE "\n" "\n err> " err " err> ${stderr}") + string(REPLACE "\n" "\n out> " out " out> ${stdout}") + string(REPLACE "\n" "\n err> " err " err> ${stderr}") if(NOT "${result}" STREQUAL "${${test}-RESULT}") message(FATAL_ERROR "Test ${test} result is [${result}], not [${${test}-RESULT}].\n" diff --git a/Tests/CMakeTests/ExecuteScriptTests.cmake b/Tests/CMakeTests/ExecuteScriptTests.cmake index c71585a..bceac33 100644 --- a/Tests/CMakeTests/ExecuteScriptTests.cmake +++ b/Tests/CMakeTests/ExecuteScriptTests.cmake @@ -52,9 +52,9 @@ function(execute_all_script_tests scriptname result) foreach(line ${script}) if(line MATCHES "${regex}") + set(testname "${CMAKE_MATCH_2}") + set(expected_result "${CMAKE_MATCH_3}") math(EXPR count "${count} + 1") - string(REGEX REPLACE "${regex}" "\\2" testname "${line}") - string(REGEX REPLACE "${regex}" "\\3" expected_result "${line}") execute_one_script_test(${scriptname} ${testname} ${expected_result}) endif() endforeach() diff --git a/Tests/CTestUpdateCommon.cmake b/Tests/CTestUpdateCommon.cmake index 642a618..857c6f5 100644 --- a/Tests/CTestUpdateCommon.cmake +++ b/Tests/CTestUpdateCommon.cmake @@ -9,7 +9,7 @@ function(run_child) ERROR_STRIP_TRAILING_WHITESPACE ) if(FAILED) - string(REGEX REPLACE "\n" "\n " OUTPUT "${OUTPUT}") + string(REPLACE "\n" "\n " OUTPUT "${OUTPUT}") message(FATAL_ERROR "Child failed (${FAILED}), output is\n ${OUTPUT}\n" "Command = [${ARGN}]\n") endif() @@ -108,7 +108,7 @@ function(check_updates build) ${TOP}/${build}/Testing/Temporary/LastUpdate*.log) if(UPDATE_LOG_FILE) file(READ ${UPDATE_LOG_FILE} UPDATE_LOG LIMIT ${max_update_xml_size}) - string(REGEX REPLACE "\n" "\n " UPDATE_LOG "${UPDATE_LOG}") + string(REPLACE "\n" "\n " UPDATE_LOG "${UPDATE_LOG}") set(MSG "${MSG}Update log:\n ${UPDATE_LOG}") else() set(MSG "${MSG}No update log found!") diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index fcde44d..d250f53 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -36,7 +36,7 @@ ASSERT(Complex_BINARY_DIR "The PROJECT command is broken") # macro(TEST_ARGC value1 value2) add_definitions(${value1} ${value2}) - if (${ARGC} MATCHES 4) + if (${ARGC} EQUAL 4) add_definitions(${ARGV2} ${ARGV3}) endif () endmacro() @@ -70,7 +70,7 @@ if(NOT 2.4 EQUAL 2.4) message(FATAL_ERROR "Failed: NOT 2.4 EQUAL 2.4") endif() -if(CMAKE_SYSTEM MATCHES "OSF1-V.*") +if(CMAKE_SYSTEM MATCHES "OSF1-V") if(NOT CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local -no_implicit_include ") endif() diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index a4a0e0e..bb00341 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -36,7 +36,7 @@ ASSERT(Complex_BINARY_DIR "The PROJECT command is broken") # macro(TEST_ARGC value1 value2) add_definitions(${value1} ${value2}) - if (${ARGC} MATCHES 4) + if (${ARGC} EQUAL 4) add_definitions(${ARGV2} ${ARGV3}) endif () endmacro() @@ -70,7 +70,7 @@ if(NOT 2.4 EQUAL 2.4) message(FATAL_ERROR "Failed: NOT 2.4 EQUAL 2.4") endif() -if(CMAKE_SYSTEM MATCHES "OSF1-V.*") +if(CMAKE_SYSTEM MATCHES "OSF1-V") if(NOT CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local -no_implicit_include ") endif() diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index a194a5f..e0854ce 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -367,8 +367,8 @@ endif() foreach(arg ${CHECK_ARGS} "") set(ARG "${arg}") - string(REGEX REPLACE "\\\\" "\\\\\\\\" ARG "${ARG}") - string(REGEX REPLACE "\"" "\\\\\"" ARG "${ARG}") + string(REPLACE "\\" "\\\\" ARG "${ARG}") + string(REPLACE "\"" "\\\"" ARG "${ARG}") set(EXPECTED_ARGUMENTS "${EXPECTED_ARGUMENTS} \"${ARG}\", ") diff --git a/Tests/FindPackageModeMakefileTest/CMakeLists.txt b/Tests/FindPackageModeMakefileTest/CMakeLists.txt index 5d1b376..8e21c32 100644 --- a/Tests/FindPackageModeMakefileTest/CMakeLists.txt +++ b/Tests/FindPackageModeMakefileTest/CMakeLists.txt @@ -10,7 +10,7 @@ if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Makefile") ERROR_QUIET TIMEOUT 10) string(TOUPPER "${makeVersionOutput}" MAKE_VERSION_OUTPUT) - if("${MAKE_VERSION_OUTPUT}" MATCHES ".*GNU MAKE.*") + if("${MAKE_VERSION_OUTPUT}" MATCHES "GNU MAKE") # build a library which we can search during the test add_library(foo STATIC foo.cpp) diff --git a/Tests/PerConfig/perconfig.cmake b/Tests/PerConfig/perconfig.cmake index 6a710ca..0731041 100644 --- a/Tests/PerConfig/perconfig.cmake +++ b/Tests/PerConfig/perconfig.cmake @@ -30,7 +30,7 @@ endif() # Verify that the implementation files are named correctly. foreach(lib pcStatic pcShared) file(STRINGS "${${lib}_file}" info LIMIT_COUNT 1 REGEX "INFO:[^[]*\\[") - if(NOT "${info}" MATCHES ".*INFO:symbol\\[${lib}\\].*") + if(NOT "${info}" MATCHES "INFO:symbol\\[${lib}\\]") message(SEND_ERROR "No INFO:symbol[${lib}] found in:\n ${${lib}_file}") endif() endforeach() diff --git a/Tests/SubDirSpaces/CMakeLists.txt b/Tests/SubDirSpaces/CMakeLists.txt index 69f1d68..40c265e 100644 --- a/Tests/SubDirSpaces/CMakeLists.txt +++ b/Tests/SubDirSpaces/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 2.6) project(SUBDIR) # Some systems do not seem to support rpath with spaces. -if("${CMAKE_SYSTEM}" MATCHES "IRIX|QNX") +if(CMAKE_SYSTEM_NAME MATCHES "IRIX|QNX") set(CMAKE_SKIP_BUILD_RPATH 1) endif() |