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 | |
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')
63 files changed, 169 insertions, 201 deletions
diff --git a/Modules/BasicConfigVersion-ExactVersion.cmake.in b/Modules/BasicConfigVersion-ExactVersion.cmake.in index 63f3f03..9fd0136 100644 --- a/Modules/BasicConfigVersion-ExactVersion.cmake.in +++ b/Modules/BasicConfigVersion-ExactVersion.cmake.in @@ -11,13 +11,13 @@ set(PACKAGE_VERSION "@CVF_VERSION@") -if("@CVF_VERSION@" MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\..*") # strip the tweak version +if("@CVF_VERSION@" MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\.") # strip the tweak version set(CVF_VERSION_NO_TWEAK "${CMAKE_MATCH_1}") else() set(CVF_VERSION_NO_TWEAK "@CVF_VERSION@") endif() -if("${PACKAGE_FIND_VERSION}" MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\..*") # strip the tweak version +if("${PACKAGE_FIND_VERSION}" MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\.") # strip the tweak version set(REQUESTED_VERSION_NO_TWEAK "${CMAKE_MATCH_1}") else() set(REQUESTED_VERSION_NO_TWEAK "${PACKAGE_FIND_VERSION}") diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index b896de2..0c733fa 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -235,8 +235,8 @@ function(get_bundle_main_executable bundle result_var) # set(eol_char "E") file(READ "${bundle}/Contents/Info.plist" info_plist) - string(REGEX REPLACE ";" "\\\\;" info_plist "${info_plist}") - string(REGEX REPLACE "\n" "${eol_char};" info_plist "${info_plist}") + string(REPLACE ";" "\\;" info_plist "${info_plist}") + string(REPLACE "\n" "${eol_char};" info_plist "${info_plist}") # Scan the lines for "<key>CFBundleExecutable</key>" - the line after that # is the name of the main executable. @@ -247,7 +247,7 @@ function(get_bundle_main_executable bundle result_var) break() endif() - if(line MATCHES "^.*<key>CFBundleExecutable</key>.*$") + if(line MATCHES "<key>CFBundleExecutable</key>") set(line_is_main_executable 1) endif() endforeach() @@ -287,7 +287,7 @@ endfunction() function(get_dotapp_dir exe dotapp_dir_var) set(s "${exe}") - if(s MATCHES "^.*/.*\\.app/.*$") + if(s MATCHES "/.*\\.app/") # If there is a ".app" parent directory, # ascend until we hit it: # (typical of a Mac bundle executable) @@ -394,7 +394,7 @@ function(get_item_key item key_var) if(WIN32) string(TOLOWER "${item_name}" item_name) endif() - string(REGEX REPLACE "\\." "_" ${key_var} "${item_name}") + string(REPLACE "." "_" ${key_var} "${item_name}") set(${key_var} ${${key_var}} PARENT_SCOPE) endfunction() diff --git a/Modules/CMakeBackwardCompatibilityCXX.cmake b/Modules/CMakeBackwardCompatibilityCXX.cmake index 343fdb2..f1db46e 100644 --- a/Modules/CMakeBackwardCompatibilityCXX.cmake +++ b/Modules/CMakeBackwardCompatibilityCXX.cmake @@ -31,15 +31,15 @@ if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS) if(NOT CMAKE_COMPILER_IS_GNUCXX) include(TestCXXAcceptsFlag) set(CMAKE_TRY_ANSI_CXX_FLAGS "") - if(CMAKE_SYSTEM MATCHES "IRIX.*") + if(CMAKE_SYSTEM_NAME MATCHES "IRIX") set(CMAKE_TRY_ANSI_CXX_FLAGS "-LANG:std") endif() - if(CMAKE_SYSTEM MATCHES "OSF.*") + if(CMAKE_SYSTEM_NAME MATCHES "OSF") set(CMAKE_TRY_ANSI_CXX_FLAGS "-std strict_ansi -nopure_cname") endif() # if CMAKE_TRY_ANSI_CXX_FLAGS has something in it, see # if the compiler accepts it - if( CMAKE_TRY_ANSI_CXX_FLAGS MATCHES ".+") + if(NOT CMAKE_TRY_ANSI_CXX_FLAGS STREQUAL "") CHECK_CXX_ACCEPTS_FLAG(${CMAKE_TRY_ANSI_CXX_FLAGS} CMAKE_CXX_ACCEPTS_FLAGS) # if the compiler liked the flag then set CMAKE_ANSI_CXXFLAGS # to the flag diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake index 1d9617f..25af3e3 100644 --- a/Modules/CMakeDetermineASMCompiler.cmake +++ b/Modules/CMakeDetermineASMCompiler.cmake @@ -18,7 +18,7 @@ include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake) if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER) # prefer the environment variable ASM - if($ENV{ASM${ASM_DIALECT}} MATCHES ".+") + if(NOT $ENV{ASM${ASM_DIALECT}} STREQUAL "") set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT "$ENV{ASM${ASM_DIALECT}}") endif() diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index aa4cdc9..3847b75 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -48,7 +48,7 @@ else() set(CMAKE_C_COMPILER_INIT NOTFOUND) # prefer the environment variable CC - if($ENV{CC} MATCHES ".+") + if(NOT $ENV{CC} STREQUAL "") get_filename_component(CMAKE_C_COMPILER_INIT $ENV{CC} PROGRAM PROGRAM_ARGS CMAKE_C_FLAGS_ENV_INIT) if(CMAKE_C_FLAGS_ENV_INIT) set(CMAKE_C_COMPILER_ARG1 "${CMAKE_C_FLAGS_ENV_INIT}" CACHE STRING "First argument to C compiler") @@ -138,7 +138,7 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX) elseif("${CMAKE_C_COMPILER_ID}" MATCHES "Clang") set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_C_COMPILER_TARGET}-) elseif(COMPILER_BASENAME MATCHES "qcc(\\.exe)?$") - if(CMAKE_C_COMPILER_TARGET MATCHES "gcc_nto([^_le]+)(le)?.*$") + if(CMAKE_C_COMPILER_TARGET MATCHES "gcc_nto([^_le]+)(le)?") set(_CMAKE_TOOLCHAIN_PREFIX nto${CMAKE_MATCH_1}-) endif() endif () diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index ef8445e..e6a9d9a 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -47,7 +47,7 @@ else() set(CMAKE_CXX_COMPILER_INIT NOTFOUND) # prefer the environment variable CXX - if($ENV{CXX} MATCHES ".+") + if(NOT $ENV{CXX} STREQUAL "") get_filename_component(CMAKE_CXX_COMPILER_INIT $ENV{CXX} PROGRAM PROGRAM_ARGS CMAKE_CXX_FLAGS_ENV_INIT) if(CMAKE_CXX_FLAGS_ENV_INIT) set(CMAKE_CXX_COMPILER_ARG1 "${CMAKE_CXX_FLAGS_ENV_INIT}" CACHE STRING "First argument to CXX compiler") @@ -135,7 +135,7 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX) elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_CXX_COMPILER_TARGET}-) elseif(COMPILER_BASENAME MATCHES "QCC(\\.exe)?$") - if(CMAKE_CXX_COMPILER_TARGET MATCHES "gcc_nto([^_le]+)(le)?.*$") + if(CMAKE_CXX_COMPILER_TARGET MATCHES "gcc_nto([^_le]+)(le)?") set(_CMAKE_TOOLCHAIN_PREFIX nto${CMAKE_MATCH_1}-) endif() endif () diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index 5d35ce3..8595b97 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -52,11 +52,11 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) "Detecting ${lang} compiler ABI info compiled with the following output:\n${OUTPUT}\n\n") file(STRINGS "${BIN}" ABI_STRINGS LIMIT_COUNT 2 REGEX "INFO:[^[]*\\[") foreach(info ${ABI_STRINGS}) - if("${info}" MATCHES ".*INFO:sizeof_dptr\\[0*([^]]*)\\].*") - string(REGEX REPLACE ".*INFO:sizeof_dptr\\[0*([^]]*)\\].*" "\\1" ABI_SIZEOF_DPTR "${info}") + if("${info}" MATCHES "INFO:sizeof_dptr\\[0*([^]]*)\\]") + set(ABI_SIZEOF_DPTR "${CMAKE_MATCH_1}") endif() - if("${info}" MATCHES ".*INFO:abi\\[([^]]*)\\].*") - string(REGEX REPLACE ".*INFO:abi\\[([^]]*)\\].*" "\\1" ABI_NAME "${info}") + if("${info}" MATCHES "INFO:abi\\[([^]]*)\\]") + set(ABI_NAME "${CMAKE_MATCH_1}") endif() endforeach() 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() diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index d38bf25..96df6a2 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -32,7 +32,7 @@ elseif("${CMAKE_GENERATOR}" MATCHES "Xcode") else() if(NOT CMAKE_Fortran_COMPILER) # prefer the environment variable CC - if($ENV{FC} MATCHES ".+") + if(NOT $ENV{FC} STREQUAL "") get_filename_component(CMAKE_Fortran_COMPILER_INIT $ENV{FC} PROGRAM PROGRAM_ARGS CMAKE_Fortran_FLAGS_ENV_INIT) if(CMAKE_Fortran_FLAGS_ENV_INIT) set(CMAKE_Fortran_COMPILER_ARG1 "${CMAKE_Fortran_FLAGS_ENV_INIT}" CACHE STRING "First argument to Fortran compiler") @@ -130,7 +130,7 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN) ARGS ${CMAKE_Fortran_COMPILER_ID_FLAGS_LIST} -E "\"${CMAKE_ROOT}/Modules/CMakeTestGNU.c\"" OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT RETURN_VALUE CMAKE_COMPILER_RETURN) if(NOT CMAKE_COMPILER_RETURN) - if("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" ) + if("${CMAKE_COMPILER_OUTPUT}" MATCHES "THIS_IS_GNU") set(CMAKE_Fortran_COMPILER_ID "GNU") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the Fortran compiler is GNU succeeded with " @@ -141,10 +141,10 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN) "the following output:\n${CMAKE_COMPILER_OUTPUT}\n\n") endif() if(NOT CMAKE_Fortran_PLATFORM_ID) - if("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_MINGW.*" ) + if("${CMAKE_COMPILER_OUTPUT}" MATCHES "THIS_IS_MINGW") set(CMAKE_Fortran_PLATFORM_ID "MinGW") endif() - if("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" ) + if("${CMAKE_COMPILER_OUTPUT}" MATCHES "THIS_IS_CYGWIN") set(CMAKE_Fortran_PLATFORM_ID "Cygwin") endif() endif() diff --git a/Modules/CMakeDetermineJavaCompiler.cmake b/Modules/CMakeDetermineJavaCompiler.cmake index 7ae7856..f657801 100644 --- a/Modules/CMakeDetermineJavaCompiler.cmake +++ b/Modules/CMakeDetermineJavaCompiler.cmake @@ -18,7 +18,7 @@ if(NOT CMAKE_Java_COMPILER) # prefer the environment variable CC - if($ENV{JAVA_COMPILER} MATCHES ".+") + if(NOT $ENV{JAVA_COMPILER} STREQUAL "") get_filename_component(CMAKE_Java_COMPILER_INIT $ENV{JAVA_COMPILER} PROGRAM PROGRAM_ARGS CMAKE_Java_FLAGS_ENV_INIT) if(CMAKE_Java_FLAGS_ENV_INIT) set(CMAKE_Java_COMPILER_ARG1 "${CMAKE_Java_FLAGS_ENV_INIT}" CACHE STRING "First argument to Java compiler") @@ -28,14 +28,14 @@ if(NOT CMAKE_Java_COMPILER) endif() endif() - if($ENV{JAVA_RUNTIME} MATCHES ".+") + if(NOT $ENV{JAVA_RUNTIME} STREQUAL "") get_filename_component(CMAKE_Java_RUNTIME_INIT $ENV{JAVA_RUNTIME} PROGRAM PROGRAM_ARGS CMAKE_Java_FLAGS_ENV_INIT) if(NOT EXISTS ${CMAKE_Java_RUNTIME_INIT}) message(SEND_ERROR "Could not find compiler set in environment variable JAVA_RUNTIME:\n$ENV{JAVA_RUNTIME}.") endif() endif() - if($ENV{JAVA_ARCHIVE} MATCHES ".+") + if(NOT $ENV{JAVA_ARCHIVE} STREQUAL "") get_filename_component(CMAKE_Java_ARCHIVE_INIT $ENV{JAVA_ARCHIVE} PROGRAM PROGRAM_ARGS CMAKE_Java_FLAGS_ENV_INIT) if(NOT EXISTS ${CMAKE_Java_ARCHIVE_INIT}) message(SEND_ERROR "Could not find compiler set in environment variable JAVA_ARCHIVE:\n$ENV{JAVA_ARCHIVE}.") diff --git a/Modules/CMakeDetermineRCCompiler.cmake b/Modules/CMakeDetermineRCCompiler.cmake index f23846e..e5414eb 100644 --- a/Modules/CMakeDetermineRCCompiler.cmake +++ b/Modules/CMakeDetermineRCCompiler.cmake @@ -20,7 +20,7 @@ # as a default compiler if(NOT CMAKE_RC_COMPILER) # prefer the environment variable RC - if($ENV{RC} MATCHES ".+") + if(NOT $ENV{RC} STREQUAL "") get_filename_component(CMAKE_RC_COMPILER_INIT $ENV{RC} PROGRAM PROGRAM_ARGS CMAKE_RC_FLAGS_ENV_INIT) if(CMAKE_RC_FLAGS_ENV_INIT) set(CMAKE_RC_COMPILER_ARG1 "${CMAKE_RC_FLAGS_ENV_INIT}" CACHE STRING "First argument to RC compiler") diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake index f1bad99..1c0941a 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -72,8 +72,8 @@ if(CMAKE_HOST_UNIX) endif() set(CMAKE_UNAME ${CMAKE_UNAME} CACHE INTERNAL "uname command") # processor may have double quote in the name, and that needs to be removed - string(REGEX REPLACE "\"" "" CMAKE_HOST_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}") - string(REGEX REPLACE "/" "_" CMAKE_HOST_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}") + string(REPLACE "\"" "" CMAKE_HOST_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}") + string(REPLACE "/" "_" CMAKE_HOST_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}") endif() else() if(CMAKE_HOST_WIN32) diff --git a/Modules/CMakeExportBuildSettings.cmake b/Modules/CMakeExportBuildSettings.cmake index 90a7a89..a8dd8c2 100644 --- a/Modules/CMakeExportBuildSettings.cmake +++ b/Modules/CMakeExportBuildSettings.cmake @@ -27,7 +27,7 @@ endif() # loaded by another project using CMAKE_IMPORT_BUILD_SETTINGS. Now it # creates a file that refuses to load (with comment explaining why). macro(CMAKE_EXPORT_BUILD_SETTINGS SETTINGS_FILE) - if(${SETTINGS_FILE} MATCHES ".+") + if(NOT ${SETTINGS_FILE} STREQUAL "") configure_file(${CMAKE_ROOT}/Modules/CMakeBuildSettings.cmake.in ${SETTINGS_FILE} @ONLY) else() diff --git a/Modules/CMakeImportBuildSettings.cmake b/Modules/CMakeImportBuildSettings.cmake index 60b887a..edecc1f 100644 --- a/Modules/CMakeImportBuildSettings.cmake +++ b/Modules/CMakeImportBuildSettings.cmake @@ -17,8 +17,7 @@ # This macro used to load build settings from another project that # stored settings using the CMAKE_EXPORT_BUILD_SETTINGS macro. macro(CMAKE_IMPORT_BUILD_SETTINGS SETTINGS_FILE) - if(${SETTINGS_FILE} MATCHES ".+") - else() + if("${SETTINGS_FILE}" STREQUAL "") message(SEND_ERROR "CMAKE_IMPORT_BUILD_SETTINGS called with no argument.") endif() endmacro() diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake index 4724a8c..bfcf455 100644 --- a/Modules/CMakeParseImplicitLinkInfo.cmake +++ b/Modules/CMakeParseImplicitLinkInfo.cmake @@ -64,10 +64,9 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj string(REGEX REPLACE "^-L" "" dir "${arg}") list(APPEND implicit_dirs_tmp ${dir}) set(log "${log} arg [${arg}] ==> dir [${dir}]\n") - elseif("${arg}" MATCHES "^-l[^:]") + elseif("${arg}" MATCHES "^-l([^:].*)$") # Unix library. - string(REGEX REPLACE "^-l" "" lib "${arg}") - list(APPEND implicit_libs_tmp ${lib}) + list(APPEND implicit_libs_tmp ${CMAKE_MATCH_1}) set(log "${log} arg [${arg}] ==> lib [${lib}]\n") elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.a$") # Unix library full path. @@ -97,11 +96,10 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj endif() endforeach() break() - elseif("${line}" MATCHES "LPATH(=| is:? )") + elseif("${line}" MATCHES "LPATH(=| is:? *)(.*)$") set(log "${log} LPATH line: [${line}]\n") # HP search path. - string(REGEX REPLACE ".*LPATH(=| is:? *)" "" paths "${line}") - string(REPLACE ":" ";" paths "${paths}") + string(REPLACE ":" ";" paths "${CMAKE_MATCH_2}") list(APPEND implicit_dirs_tmp ${paths}) set(log "${log} dirs [${paths}]\n") else() diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index b210bbb..458bbed 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -259,7 +259,7 @@ if(CPACK_DEBIAN_PACKAGE_SHLIBDEPS) OUTPUT_VARIABLE CPACK_DEB_INSTALL_FILES) # Convert to CMake list - string(REGEX REPLACE "\n" ";" CPACK_DEB_INSTALL_FILES ${CPACK_DEB_INSTALL_FILES}) + string(REPLACE "\n" ";" CPACK_DEB_INSTALL_FILES ${CPACK_DEB_INSTALL_FILES}) # Only dynamically linked ELF files are included # Extract only file name infront of ":" diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index a13a46f..2864b21 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -384,7 +384,7 @@ if(CPACK_RPM_PACKAGE_DEBUG) OUTPUT_VARIABLE _TMP_LSB_RELEASE_OUTPUT ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REGEX REPLACE "\n" ", " + string(REPLACE "\n" ", " LSB_RELEASE_OUTPUT ${_TMP_LSB_RELEASE_OUTPUT}) else () @@ -397,7 +397,7 @@ endif() # to shut down warning about space in buildtree # some recent RPM version should support space in different places. # not checked [yet]. -if(CPACK_TOPLEVEL_DIRECTORY MATCHES ".* .*") +if(CPACK_TOPLEVEL_DIRECTORY MATCHES " ") message(FATAL_ERROR "${RPMBUILD_EXECUTABLE} can't handle paths with spaces, use a build directory without spaces for building RPMs.") endif() diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake index d4651b9..ad3b6b5 100644 --- a/Modules/CheckTypeSize.cmake +++ b/Modules/CheckTypeSize.cmake @@ -142,7 +142,7 @@ function(__check_type_size_impl type var map builtin language) foreach(info ${strings}) if("${info}" MATCHES "${regex_size}") # Get the type size. - string(REGEX REPLACE "${regex_size}" "\\1" size "${info}") + set(size "${CMAKE_MATCH_1}") if(first) set(${var} ${size}) elseif(NOT "${size}" STREQUAL "${${var}}") diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake index 1e2698c..ee20693 100644 --- a/Modules/ExternalData.cmake +++ b/Modules/ExternalData.cmake @@ -292,8 +292,7 @@ function(ExternalData_expand_arguments target outArgsVar) foreach(piece IN LISTS pieces) if("x${piece}" MATCHES "^x${data_regex}$") # Replace this DATA{}-piece with a file path. - string(REGEX REPLACE "${data_regex}" "\\1" data "${piece}") - _ExternalData_arg("${target}" "${piece}" "${data}" file) + _ExternalData_arg("${target}" "${piece}" "${CMAKE_MATCH_1}" file) set(outArg "${outArg}${file}") else() # No replacement needed for this piece. @@ -428,10 +427,9 @@ function(_ExternalData_arg target arg options var_file) set(associated_files "") set(associated_regex "") foreach(opt ${options}) - if("x${opt}" MATCHES "^xREGEX:[^:/]+$") - # Regular expression to match associated files. - string(REGEX REPLACE "^REGEX:" "" regex "${opt}") - list(APPEND associated_regex "${regex}") + # Regular expression to match associated files. + if("x${opt}" MATCHES "^xREGEX:([^:/]+)$") + list(APPEND associated_regex "${CMAKE_MATCH_1}") elseif(opt STREQUAL ":") # Activate series matching. set(series_option "${opt}") diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 3ba91de..f587985 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -201,11 +201,11 @@ file(STRINGS "${CMAKE_CURRENT_LIST_FILE}" lines LIMIT_COUNT ${_ep_documentation_line_count} REGEX "^# ( \\[[A-Z0-9_]+ [^]]*\\] +#.*$|[A-Za-z0-9_]+\\()") foreach(line IN LISTS lines) - if("${line}" MATCHES "^# [A-Za-z0-9_]+\\(") + if("${line}" MATCHES "^# ([A-Za-z0-9_]+)\\(") if(_ep_func) set(_ep_keywords_${_ep_func} "${_ep_keywords_${_ep_func}})$") endif() - string(REGEX REPLACE "^# ([A-Za-z0-9_]+)\\(.*" "\\1" _ep_func "${line}") + set(_ep_func "${CMAKE_MATCH_1}") #message("function [${_ep_func}]") set(_ep_keywords_${_ep_func} "^(") set(_ep_keyword_sep) @@ -907,7 +907,8 @@ function(_ep_write_initial_cache target_name script_filename args) set(regex "^([^:]+):([^=]+)=(.*)$") set(setArg "") foreach(line ${args}) - if("${line}" MATCHES "^-D") + if("${line}" MATCHES "^-D(.*)") + set(line "${CMAKE_MATCH_1}") if(setArg) # This is required to build up lists in variables, or complete an entry set(setArg "${setArg}${accumulator}\" CACHE ${type} \"Initial cache\" FORCE)") @@ -915,9 +916,7 @@ function(_ep_write_initial_cache target_name script_filename args) set(accumulator "") set(setArg "") endif() - string(REGEX REPLACE "^-D" "" line ${line}) if("${line}" MATCHES "${regex}") - string(REGEX MATCH "${regex}" match "${line}") set(name "${CMAKE_MATCH_1}") set(type "${CMAKE_MATCH_2}") set(value "${CMAKE_MATCH_3}") diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake index a72954c..12ea384 100644 --- a/Modules/FeatureSummary.cmake +++ b/Modules/FeatureSummary.cmake @@ -546,10 +546,10 @@ function(SET_PACKAGE_INFO _name _desc) set(_url "${ARGV2}") set(_purpose "${ARGV3}") set_property(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_desc}" ) - if(_url MATCHES ".+") + if(NOT _url STREQUAL "") set_property(GLOBAL PROPERTY _CMAKE_${_name}_URL "${_url}" ) endif() - if(_purpose MATCHES ".+") + if(NOT _purpose STREQUAL "") set_property(GLOBAL APPEND PROPERTY _CMAKE_${_name}_PURPOSE "${_purpose}" ) endif() endfunction() diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake index 9ca428e..ec3ee78 100644 --- a/Modules/FindBISON.cmake +++ b/Modules/FindBISON.cmake @@ -92,16 +92,13 @@ if(BISON_EXECUTABLE) message(SEND_ERROR "Command \"${BISON_EXECUTABLE} --version\" failed with output:\n${BISON_version_error}") else() # Bison++ - if("${BISON_version_output}" MATCHES "^bison\\+\\+") - string(REGEX REPLACE "^bison\\+\\+ Version ([^,]+).*" "\\1" - BISON_VERSION "${BISON_version_output}") + if("${BISON_version_output}" MATCHES "^bison\\+\\+ Version ([^,]+)") + set(BISON_VERSION "${CMAKE_MATCH_1}") # GNU Bison - elseif("${BISON_version_output}" MATCHES "^bison[^+]") - string(REGEX REPLACE "^bison \\(GNU Bison\\) ([^\n]+)\n.*" "\\1" - BISON_VERSION "${BISON_version_output}") - elseif("${BISON_version_output}" MATCHES "^GNU Bison ") - string(REGEX REPLACE "^GNU Bison (version )?([^\n]+).*" "\\2" - BISON_VERSION "${BISON_version_output}") + elseif("${BISON_version_output}" MATCHES "^bison \\(GNU Bison\\) ([^\n]+)\n") + set(BISON_VERSION "${CMAKE_MATCH_1}") + elseif("${BISON_version_output}" MATCHES "^GNU Bison (version )?([^\n]+)") + set(BISON_VERSION "${CMAKE_MATCH_2}") endif() endif() diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 1cf9124..6a583d9 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -150,7 +150,7 @@ endmacro() set(BLAS_LINKER_FLAGS) set(BLAS_LIBRARIES) set(BLAS95_LIBRARIES) -if ($ENV{BLA_VENDOR} MATCHES ".+") +if (NOT $ENV{BLA_VENDOR} STREQUAL "") set(BLA_VENDOR $ENV{BLA_VENDOR}) else () if(NOT BLA_VENDOR) @@ -288,7 +288,7 @@ if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All") endif () #BLAS in acml library? -if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All") +if (BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All") if( ((BLA_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR ((BLA_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) OR ((BLA_VENDOR STREQUAL "ACML_GPU") AND (NOT BLAS_ACML_GPU_LIB_DIRS)) @@ -465,7 +465,7 @@ if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") endif () #BLAS in intel mkl 10 library? (em64t 64bit) -if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") +if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") if (NOT WIN32) set(LM "-lm") endif () @@ -532,7 +532,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") "mkl_blas95 mkl_intel_lp64 mkl_intel_thread mkl_core guide") # mkl >= 10.3 - if (CMAKE_C_COMPILER MATCHES ".+gcc.*") + if (CMAKE_C_COMPILER MATCHES ".+gcc") list(APPEND BLAS_SEARCH_LIBS "mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core gomp") else () @@ -600,7 +600,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") "mkl_intel_lp64 mkl_intel_thread mkl_core guide") # mkl >= 10.3 - if (CMAKE_C_COMPILER MATCHES ".+gcc.*") + if (CMAKE_C_COMPILER MATCHES ".+gcc") list(APPEND BLAS_SEARCH_LIBS "mkl_intel_lp64 mkl_gnu_thread mkl_core gomp") else () diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index d4026af..dfd4460 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -631,12 +631,12 @@ if(NOT Boost_INCLUDE_DIR) set(_boost_BOOSTIFIED_VERSION) # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0 - if(_boost_VER MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+") - string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3" - _boost_BOOSTIFIED_VERSION ${_boost_VER}) - elseif(_boost_VER MATCHES "[0-9]+\\.[0-9]+") - string(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2" - _boost_BOOSTIFIED_VERSION ${_boost_VER}) + if(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+)") + set(_boost_BOOSTIFIED_VERSION + "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}_${CMAKE_MATCH_3}") + elseif(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)") + set(_boost_BOOSTIFIED_VERSION + "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}") endif() list(APPEND _boost_PATH_SUFFIXES @@ -684,7 +684,7 @@ if(Boost_INCLUDE_DIR) set(_Boost_VERSION_REGEX "([0-9]+)") set(_Boost_LIB_VERSION_REGEX "\"([0-9_]+)\"") foreach(v VERSION LIB_VERSION) - if("${_boost_VERSION_HPP_CONTENTS}" MATCHES ".*#define BOOST_${v} ${_Boost_${v}_REGEX}.*") + if("${_boost_VERSION_HPP_CONTENTS}" MATCHES "#define BOOST_${v} ${_Boost_${v}_REGEX}") set(Boost_${v} "${CMAKE_MATCH_1}") endif() endforeach() diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 94f82f6..c02809d 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -1194,7 +1194,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) foreach(file ${ARGN}) # Ignore any file marked as a HEADER_FILE_ONLY get_source_file_property(_is_header ${file} HEADER_FILE_ONLY) - if(${file} MATCHES ".*\\.cu$" AND NOT _is_header) + if(${file} MATCHES "\\.cu$" AND NOT _is_header) # Allow per source file overrides of the format. get_source_file_property(_cuda_source_format ${file} CUDA_SOURCE_PROPERTY_FORMAT) diff --git a/Modules/FindCUDA/make2cmake.cmake b/Modules/FindCUDA/make2cmake.cmake index 1b53d17..c433fa8 100644 --- a/Modules/FindCUDA/make2cmake.cmake +++ b/Modules/FindCUDA/make2cmake.cmake @@ -37,12 +37,11 @@ file(READ ${input_file} depend_text) -if (${depend_text} MATCHES ".+") +if (NOT "${depend_text}" STREQUAL "") # message("FOUND DEPENDS") - # Remember, four backslashes is escaped to one backslash in the string. - string(REGEX REPLACE "\\\\ " " " depend_text ${depend_text}) + string(REPLACE "\\ " " " depend_text ${depend_text}) # This works for the nvcc -M generated dependency files. string(REGEX REPLACE "^.* : " "" depend_text ${depend_text}) diff --git a/Modules/FindCUDA/parse_cubin.cmake b/Modules/FindCUDA/parse_cubin.cmake index 94be7e2..626c8a2 100644 --- a/Modules/FindCUDA/parse_cubin.cmake +++ b/Modules/FindCUDA/parse_cubin.cmake @@ -37,11 +37,10 @@ file(READ ${input_file} file_text) -if (${file_text} MATCHES ".+") +if (NOT "${file_text}" STREQUAL "") - # Remember, four backslashes is escaped to one backslash in the string. - string(REGEX REPLACE ";" "\\\\;" file_text ${file_text}) - string(REGEX REPLACE "\ncode" ";code" file_text ${file_text}) + string(REPLACE ";" "\\;" file_text ${file_text}) + string(REPLACE "\ncode" ";code" file_text ${file_text}) list(LENGTH file_text len) @@ -57,7 +56,7 @@ if (${file_text} MATCHES ".+") # Extract kernel names. if (${entry} MATCHES "[^g]name = ([^ ]+)") - string(REGEX REPLACE ".* = ([^ ]+)" "\\1" entry ${entry}) + set(entry "${CMAKE_MATCH_1}") # Check to see if the kernel name starts with "_" set(skip FALSE) @@ -76,19 +75,19 @@ if (${file_text} MATCHES ".+") # Registers if (${entry} MATCHES "reg([ ]+)=([ ]+)([^ ]+)") - string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry}) + set(entry "${CMAKE_MATCH_3}") message("Registers: ${entry}") endif() # Local memory if (${entry} MATCHES "lmem([ ]+)=([ ]+)([^ ]+)") - string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry}) + set(entry "${CMAKE_MATCH_3}") message("Local: ${entry}") endif() # Shared memory if (${entry} MATCHES "smem([ ]+)=([ ]+)([^ ]+)") - string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry}) + set(entry "${CMAKE_MATCH_3}") message("Shared: ${entry}") endif() diff --git a/Modules/FindCups.cmake b/Modules/FindCups.cmake index 61353ca..51eb7c5 100644 --- a/Modules/FindCups.cmake +++ b/Modules/FindCups.cmake @@ -52,9 +52,8 @@ if (CUPS_INCLUDE_DIR AND EXISTS "${CUPS_INCLUDE_DIR}/cups/cups.h") unset(CUPS_VERSION_STRING) foreach(VPART MAJOR MINOR PATCH) foreach(VLINE ${cups_version_str}) - if(VLINE MATCHES "^#[\t ]*define[\t ]+CUPS_VERSION_${VPART}") - string(REGEX REPLACE "^#[\t ]*define[\t ]+CUPS_VERSION_${VPART}[\t ]+([0-9]+)$" "\\1" - CUPS_VERSION_PART "${VLINE}") + if(VLINE MATCHES "^#[\t ]*define[\t ]+CUPS_VERSION_${VPART}[\t ]+([0-9]+)$") + set(CUPS_VERSION_PART "${CMAKE_MATCH_1}") if(CUPS_VERSION_STRING) set(CUPS_VERSION_STRING "${CUPS_VERSION_STRING}.${CUPS_VERSION_PART}") else() diff --git a/Modules/FindEXPAT.cmake b/Modules/FindEXPAT.cmake index 6183af8..653094c 100644 --- a/Modules/FindEXPAT.cmake +++ b/Modules/FindEXPAT.cmake @@ -38,9 +38,8 @@ if (EXPAT_INCLUDE_DIR AND EXISTS "${EXPAT_INCLUDE_DIR}/expat.h") unset(EXPAT_VERSION_STRING) foreach(VPART MAJOR MINOR MICRO) foreach(VLINE ${expat_version_str}) - if(VLINE MATCHES "^#[\t ]*define[\t ]+XML_${VPART}_VERSION") - string(REGEX REPLACE "^#[\t ]*define[\t ]+XML_${VPART}_VERSION[\t ]+([0-9]+)$" "\\1" - EXPAT_VERSION_PART "${VLINE}") + if(VLINE MATCHES "^#[\t ]*define[\t ]+XML_${VPART}_VERSION[\t ]+([0-9]+)$") + set(EXPAT_VERSION_PART "${CMAKE_MATCH_1}") if(EXPAT_VERSION_STRING) set(EXPAT_VERSION_STRING "${EXPAT_VERSION_STRING}.${EXPAT_VERSION_PART}") else() diff --git a/Modules/FindFLTK.cmake b/Modules/FindFLTK.cmake index b87bc7f..76f702e 100644 --- a/Modules/FindFLTK.cmake +++ b/Modules/FindFLTK.cmake @@ -285,9 +285,7 @@ endif() OUTPUT_VARIABLE FLTK_IMAGES_LDFLAGS) set(FLTK_LIBS_EXTRACT_REGEX ".*-lfltk_images (.*) -lfltk.*") if("${FLTK_IMAGES_LDFLAGS}" MATCHES "${FLTK_LIBS_EXTRACT_REGEX}") - string(REGEX REPLACE "${FLTK_LIBS_EXTRACT_REGEX}" "\\1" - FLTK_IMAGES_LIBS "${FLTK_IMAGES_LDFLAGS}") - string(REGEX REPLACE " +" ";" FLTK_IMAGES_LIBS "${FLTK_IMAGES_LIBS}") + string(REGEX REPLACE " +" ";" FLTK_IMAGES_LIBS "${CMAKE_MATCH_1}") # The EXEC_PROGRAM will not be inherited into subdirectories from # the file that originally included this module. Save the answer. set(FLTK_IMAGES_LIBS "${FLTK_IMAGES_LIBS}" CACHE INTERNAL diff --git a/Modules/FindFLTK2.cmake b/Modules/FindFLTK2.cmake index 4deffda..930acca 100644 --- a/Modules/FindFLTK2.cmake +++ b/Modules/FindFLTK2.cmake @@ -226,9 +226,7 @@ if(FLTK2_DIR) OUTPUT_VARIABLE FLTK2_IMAGES_LDFLAGS) set(FLTK2_LIBS_EXTRACT_REGEX ".*-lfltk2_images (.*) -lfltk2.*") if("${FLTK2_IMAGES_LDFLAGS}" MATCHES "${FLTK2_LIBS_EXTRACT_REGEX}") - string(REGEX REPLACE "${FLTK2_LIBS_EXTRACT_REGEX}" "\\1" - FLTK2_IMAGES_LIBS "${FLTK2_IMAGES_LDFLAGS}") - string(REGEX REPLACE " +" ";" FLTK2_IMAGES_LIBS "${FLTK2_IMAGES_LIBS}") + string(REGEX REPLACE " +" ";" FLTK2_IMAGES_LIBS "${CMAKE_MATCH_1}") # The EXEC_PROGRAM will not be inherited into subdirectories from # the file that originally included this module. Save the answer. set(FLTK2_IMAGES_LIBS "${FLTK2_IMAGES_LIBS}" CACHE INTERNAL diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake index f0f9fe1..1779b78 100644 --- a/Modules/FindFreetype.cmake +++ b/Modules/FindFreetype.cmake @@ -117,9 +117,8 @@ if(FREETYPE_INCLUDE_DIR_freetype2 AND FREETYPE_H) unset(FREETYPE_VERSION_STRING) foreach(VPART MAJOR MINOR PATCH) foreach(VLINE ${freetype_version_str}) - if(VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}") - string(REGEX REPLACE "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$" "\\1" - FREETYPE_VERSION_PART "${VLINE}") + if(VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$") + set(FREETYPE_VERSION_PART "${CMAKE_MATCH_1}") if(FREETYPE_VERSION_STRING) set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_STRING}.${FREETYPE_VERSION_PART}") else() diff --git a/Modules/FindGDAL.cmake b/Modules/FindGDAL.cmake index 4e04c31..bf374f9 100644 --- a/Modules/FindGDAL.cmake +++ b/Modules/FindGDAL.cmake @@ -90,9 +90,9 @@ if(UNIX) exec_program(${GDAL_CONFIG} ARGS --libs OUTPUT_VARIABLE GDAL_CONFIG_LIBS) if(GDAL_CONFIG_LIBS) string(REGEX MATCHALL "-l[^ ]+" _gdal_dashl ${GDAL_CONFIG_LIBS}) - string(REGEX REPLACE "-l" "" _gdal_lib "${_gdal_dashl}") + string(REPLACE "-l" "" _gdal_lib "${_gdal_dashl}") string(REGEX MATCHALL "-L[^ ]+" _gdal_dashL ${GDAL_CONFIG_LIBS}) - string(REGEX REPLACE "-L" "" _gdal_libpath "${_gdal_dashL}") + string(REPLACE "-L" "" _gdal_libpath "${_gdal_dashL}") endif() endif() endif() diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake index 6a1e36e..7ab867b 100644 --- a/Modules/FindGettext.cmake +++ b/Modules/FindGettext.cmake @@ -71,8 +71,8 @@ if(GETTEXT_MSGMERGE_EXECUTABLE) OUTPUT_VARIABLE gettext_version ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - if (gettext_version MATCHES "^msgmerge \\(.*\\) [0-9]") - string(REGEX REPLACE "^msgmerge \\([^\\)]*\\) ([0-9\\.]+[^ \n]*).*" "\\1" GETTEXT_VERSION_STRING "${gettext_version}") + if (gettext_version MATCHES "^msgmerge \\([^\\)]*\\) ([0-9\\.]+[^ \n]*)") + set(GETTEXT_VERSION_STRING "${CMAKE_MATCH_1}") endif() unset(gettext_version) endif() diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index 2903bf8..0d58e13 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -162,7 +162,7 @@ macro( _HDF5_parse_compile_line ) foreach( IPATH ${include_path_flags} ) string( REGEX REPLACE "^-I" "" IPATH ${IPATH} ) - string( REGEX REPLACE "//" "/" IPATH ${IPATH} ) + string( REPLACE "//" "/" IPATH ${IPATH} ) list( APPEND ${include_paths} ${IPATH} ) endforeach() @@ -179,7 +179,7 @@ macro( _HDF5_parse_compile_line foreach( LPATH ${library_path_flags} ) string( REGEX REPLACE "^-L" "" LPATH ${LPATH} ) - string( REGEX REPLACE "//" "/" LPATH ${LPATH} ) + string( REPLACE "//" "/" LPATH ${LPATH} ) list( APPEND ${library_paths} ${LPATH} ) endforeach() @@ -253,7 +253,7 @@ if( NOT HDF5_FOUND ) list( APPEND HDF5_DEFINITIONS ${HDF5_${LANGUAGE}_DEFINITIONS} ) # find the HDF5 include directories - if(${LANGUAGE} MATCHES "Fortran.*") + if(${LANGUAGE} MATCHES "Fortran") set(HDF5_INCLUDE_FILENAME hdf5.mod) else() set(HDF5_INCLUDE_FILENAME hdf5.h) diff --git a/Modules/FindIcotool.cmake b/Modules/FindIcotool.cmake index e29fe2e..a7c5a64 100644 --- a/Modules/FindIcotool.cmake +++ b/Modules/FindIcotool.cmake @@ -37,7 +37,7 @@ if(ICOTOOL_EXECUTABLE) ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE ) - if("${_icotool_version}" MATCHES "^icotool \\([^\\)]*\\) ([0-9\\.]+[^ \n]*).*") + if("${_icotool_version}" MATCHES "^icotool \\([^\\)]*\\) ([0-9\\.]+[^ \n]*)") set( ICOTOOL_VERSION_STRING "${CMAKE_MATCH_1}" ) diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake index 1e7bda5..4f0e687 100644 --- a/Modules/FindImageMagick.cmake +++ b/Modules/FindImageMagick.cmake @@ -221,8 +221,8 @@ if(ImageMagick_mogrify_EXECUTABLE) OUTPUT_VARIABLE imagemagick_version ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - if(imagemagick_version MATCHES "^Version: ImageMagick [0-9]") - string(REGEX REPLACE "^Version: ImageMagick ([-0-9\\.]+).*" "\\1" ImageMagick_VERSION_STRING "${imagemagick_version}") + if(imagemagick_version MATCHES "^Version: ImageMagick ([-0-9\\.]+)") + set(ImageMagick_VERSION_STRING "${CMAKE_MATCH_1}") endif() unset(imagemagick_version) endif() diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake index a488c46..0bd7eb0 100644 --- a/Modules/FindJava.cmake +++ b/Modules/FindJava.cmake @@ -128,18 +128,15 @@ if(Java_JAVA_EXECUTABLE) # 3. GCJ 1.5 # 4. Kaffe 1.4.2 # 5. OpenJDK 1.7.x on OpenBSD - if(var MATCHES "java version \"[0-9]+\\.[0-9]+\\.[0-9_.]+.*\".*") + if(var MATCHES "java version \"([0-9]+\\.[0-9]+\\.[0-9_.]+.*)\"") # This is most likely Sun / OpenJDK, or maybe GCJ-java compat layer - string( REGEX REPLACE ".* version \"([0-9]+\\.[0-9]+\\.[0-9_.]+.*)\".*" - "\\1" Java_VERSION_STRING "${var}" ) - elseif(var MATCHES "java full version \"kaffe-[0-9]+\\.[0-9]+\\.[0-9_]+\".*") + set(Java_VERSION_STRING "${CMAKE_MATCH_1}") + elseif(var MATCHES "java full version \"kaffe-([0-9]+\\.[0-9]+\\.[0-9_]+)\"") # Kaffe style - string( REGEX REPLACE "java full version \"kaffe-([0-9]+\\.[0-9]+\\.[0-9_]+).*" - "\\1" Java_VERSION_STRING "${var}" ) - elseif(var MATCHES "openjdk version \"[0-9]+\\.[0-9]+\\.[0-9_]+\".*") + set(Java_VERSION_STRING "${CMAKE_MATCH_1}") + elseif(var MATCHES "openjdk version \"([0-9]+\\.[0-9]+\\.[0-9_]+)\"") # OpenJDK ver 1.7.x on OpenBSD - string( REGEX REPLACE "openjdk version \"([0-9]+\\.[0-9]+\\.[0-9_]+).*" - "\\1" Java_VERSION_STRING "${var}" ) + set(Java_VERSION_STRING "${CMAKE_MATCH_1}") else() if(NOT Java_FIND_QUIETLY) message(WARNING "regex not supported: ${var}. Please report") diff --git a/Modules/FindKDE3.cmake b/Modules/FindKDE3.cmake index 159e29c..ea898a6 100644 --- a/Modules/FindKDE3.cmake +++ b/Modules/FindKDE3.cmake @@ -192,7 +192,7 @@ if(KDECONFIG_EXECUTABLE) if ("${kde_version}" MATCHES "KDE: 3\\.") execute_process(COMMAND ${KDECONFIG_EXECUTABLE} --prefix OUTPUT_VARIABLE kdedir ) - string(REGEX REPLACE "\n" "" KDE3PREFIX "${kdedir}") + string(REPLACE "\n" "" KDE3PREFIX "${kdedir}") endif () endif() diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 33f4f0c..b11edc3 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -159,7 +159,7 @@ endif() if(BLAS_FOUND) set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS}) - if ($ENV{BLA_VENDOR} MATCHES ".+") + if (NOT $ENV{BLA_VENDOR} STREQUAL "") set(BLA_VENDOR $ENV{BLA_VENDOR}) else () if(NOT BLA_VENDOR) @@ -183,7 +183,7 @@ endif () #acml lapack - if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All") + if (BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All") if (BLAS_LIBRARIES MATCHES ".+acml.+") set (LAPACK_LIBRARIES ${BLAS_LIBRARIES}) endif () @@ -233,7 +233,7 @@ if (BLA_VENDOR STREQUAL "Generic" OR endif () endif () #intel lapack -if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") +if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") if (NOT WIN32) set(LM "-lm") endif () diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index aa2dcee..6e15f3b 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -330,7 +330,7 @@ function (interrogate_mpi_compiler lang try_libs) string(REGEX MATCHALL "(^| )-I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}") foreach(IPATH ${MPI_ALL_INCLUDE_PATHS}) string(REGEX REPLACE "^ ?-I" "" IPATH ${IPATH}) - string(REGEX REPLACE "//" "/" IPATH ${IPATH}) + string(REPLACE "//" "/" IPATH ${IPATH}) list(APPEND MPI_INCLUDE_PATH_WORK ${IPATH}) endforeach() @@ -354,7 +354,7 @@ function (interrogate_mpi_compiler lang try_libs) set(MPI_LINK_PATH) foreach(LPATH ${MPI_ALL_LINK_PATHS}) string(REGEX REPLACE "^(| |-Wl,)-L" "" LPATH ${LPATH}) - string(REGEX REPLACE "//" "/" LPATH ${LPATH}) + string(REPLACE "//" "/" LPATH ${LPATH}) list(APPEND MPI_LINK_PATH ${LPATH}) endforeach() diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake index 873c3de..fa04bf0 100644 --- a/Modules/FindPNG.cmake +++ b/Modules/FindPNG.cmake @@ -56,10 +56,8 @@ if(ZLIB_FOUND) list(APPEND PNG_NAMES png libpng) unset(PNG_NAMES_DEBUG) set(_PNG_VERSION_SUFFIXES 17 16 15 14 12) - if (PNG_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\..*)?$") - string(REGEX REPLACE - "^([0-9]+)\\.([0-9]+).*" "\\1\\2" - _PNG_VERSION_SUFFIX_MIN "${PNG_FIND_VERSION}") + if (PNG_FIND_VERSION MATCHES "^([0-9]+)\\.([0-9]+)(\\..*)?$") + set(_PNG_VERSION_SUFFIX_MIN "${CMAKE_MATCH_1}${CMAKE_MATCH_2}") if (PNG_FIND_VERSION_EXACT) set(_PNG_VERSION_SUFFIXES ${_PNG_VERSION_SUFFIX_MIN}) else () diff --git a/Modules/FindPackageMessage.cmake b/Modules/FindPackageMessage.cmake index b6a58e4..a0349d3 100644 --- a/Modules/FindPackageMessage.cmake +++ b/Modules/FindPackageMessage.cmake @@ -42,7 +42,7 @@ function(FIND_PACKAGE_MESSAGE pkg msg details) # Avoid printing a message repeatedly for the same find result. if(NOT ${pkg}_FIND_QUIETLY) - string(REGEX REPLACE "[\n]" "" details "${details}") + string(REPLACE "\n" "" details "${details}") set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg}) if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}") # The message has not yet been printed. diff --git a/Modules/FindPerl.cmake b/Modules/FindPerl.cmake index 3fd5d8e..70284b6 100644 --- a/Modules/FindPerl.cmake +++ b/Modules/FindPerl.cmake @@ -70,9 +70,9 @@ if(PERL_EXECUTABLE) OUTPUT_STRIP_TRAILING_WHITESPACE ) if(NOT PERL_VERSION_RESULT_VARIABLE AND PERL_VERSION_OUTPUT_VARIABLE MATCHES "This is perl.*[ \\(]v([0-9\\._]+)[ \\)]") - string(REGEX REPLACE ".*This is perl.*[ \\(]v([0-9\\._]+)[ \\)].*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE}) + set(PERL_VERSION_STRING "${CMAKE_MATCH_1}") elseif(NOT PERL_VERSION_RESULT_VARIABLE AND PERL_VERSION_OUTPUT_VARIABLE MATCHES "This is perl, version ([0-9\\._]+) +") - string(REGEX REPLACE ".*This is perl, version ([0-9\\._]+) +.*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE}) + set(PERL_VERSION_STRING "${CMAKE_MATCH_1}") endif() endif() endif() diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index 8327143..d728324 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -277,10 +277,10 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma set(_pkg_check_modules_exist_query) # check whether version is given - if (_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*") - string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\1" _pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}") - string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\2" _pkg_check_modules_pkg_op "${_pkg_check_modules_pkg}") - string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\3" _pkg_check_modules_pkg_ver "${_pkg_check_modules_pkg}") + if (_pkg_check_modules_pkg MATCHES "(.*[^><])(>=|=|<=)(.*)") + set(_pkg_check_modules_pkg_name "${CMAKE_MATCH_1}") + set(_pkg_check_modules_pkg_op "${CMAKE_MATCH_2}") + set(_pkg_check_modules_pkg_ver "${CMAKE_MATCH_3}") else() set(_pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}") set(_pkg_check_modules_pkg_op) diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake index c41f3a7..5e5c7b9 100644 --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake @@ -138,8 +138,8 @@ if(PYTHON_EXECUTABLE) string(REGEX REPLACE " .*" "" PYTHON_VERSION_STRING "${_VERSION}") string(REGEX REPLACE "^([0-9]+)\\.[0-9]+.*" "\\1" PYTHON_VERSION_MAJOR "${PYTHON_VERSION_STRING}") string(REGEX REPLACE "^[0-9]+\\.([0-9])+.*" "\\1" PYTHON_VERSION_MINOR "${PYTHON_VERSION_STRING}") - if(PYTHON_VERSION_STRING MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+.*") - string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" PYTHON_VERSION_PATCH "${PYTHON_VERSION_STRING}") + if(PYTHON_VERSION_STRING MATCHES "^[0-9]+\\.[0-9]+\\.([0-9]+)") + set(PYTHON_VERSION_PATCH "${CMAKE_MATCH_1}") else() set(PYTHON_VERSION_PATCH "0") endif() diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake index e893c7a..1bc0940 100644 --- a/Modules/FindQt.cmake +++ b/Modules/FindQt.cmake @@ -87,7 +87,7 @@ find_program(QT_QMAKE_EXECUTABLE_FINDQT NAMES qmake PATHS "${QT_SEARCH_PATH}/bin if(QT_QMAKE_EXECUTABLE_FINDQT) exec_program(${QT_QMAKE_EXECUTABLE_FINDQT} ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION) - if(QTVERSION MATCHES "4.*") + if(QTVERSION MATCHES "4") set(QT_QMAKE_EXECUTABLE ${QT_QMAKE_EXECUTABLE_FINDQT} CACHE PATH "Qt4 qmake program.") set(QT4_INSTALLED TRUE) endif() @@ -154,12 +154,12 @@ else() endif() endif() -if(DESIRED_QT_VERSION MATCHES 3) +if(DESIRED_QT_VERSION EQUAL 3) set(Qt3_FIND_REQUIRED ${Qt_FIND_REQUIRED}) set(Qt3_FIND_QUIETLY ${Qt_FIND_QUIETLY}) include(${CMAKE_CURRENT_LIST_DIR}/FindQt3.cmake) endif() -if(DESIRED_QT_VERSION MATCHES 4) +if(DESIRED_QT_VERSION EQUAL 4) set(Qt4_FIND_REQUIRED ${Qt_FIND_REQUIRED}) set(Qt4_FIND_QUIETLY ${Qt_FIND_QUIETLY}) include(${CMAKE_CURRENT_LIST_DIR}/FindQt4.cmake) diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake index 6cd12c6..4fc6829 100644 --- a/Modules/FindQt3.cmake +++ b/Modules/FindQt3.cmake @@ -295,12 +295,12 @@ if(QT_UIC_EXECUTABLE) endif() set(_QT_UIC_VERSION_3 FALSE) -if("${QTVERSION_UIC}" MATCHES ".* 3..*") +if("${QTVERSION_UIC}" MATCHES " 3.") set(_QT_UIC_VERSION_3 TRUE) endif() set(_QT_MOC_VERSION_3 FALSE) -if("${QTVERSION_MOC}" MATCHES ".* 3..*") +if("${QTVERSION_MOC}" MATCHES " 3.") set(_QT_MOC_VERSION_3 TRUE) endif() diff --git a/Modules/FindSquish.cmake b/Modules/FindSquish.cmake index 5cff122..4076521 100644 --- a/Modules/FindSquish.cmake +++ b/Modules/FindSquish.cmake @@ -184,7 +184,7 @@ if(SQUISH_CLIENT_EXECUTABLE) execute_process(COMMAND "${SQUISH_CLIENT_EXECUTABLE}" --version OUTPUT_VARIABLE _squishVersionOutput ERROR_QUIET ) - if("${_squishVersionOutput}" MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+).*$") + if("${_squishVersionOutput}" MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+)") set(SQUISH_VERSION_MAJOR "${CMAKE_MATCH_1}") set(SQUISH_VERSION_MINOR "${CMAKE_MATCH_2}") set(SQUISH_VERSION_PATCH "${CMAKE_MATCH_3}") diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index 6d1c65d..6050dcd 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -41,7 +41,7 @@ set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET}) set(CMAKE_REQUIRED_QUIET ${Threads_FIND_QUIETLY}) # Do we have sproc? -if(CMAKE_SYSTEM MATCHES IRIX AND NOT CMAKE_THREAD_PREFER_PTHREAD) +if(CMAKE_SYSTEM_NAME MATCHES IRIX AND NOT CMAKE_THREAD_PREFER_PTHREAD) CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h" CMAKE_HAVE_SPROC_H) endif() @@ -138,13 +138,13 @@ if(CMAKE_THREAD_LIBS_INIT OR CMAKE_HAVE_LIBC_CREATE) set(Threads_FOUND TRUE) endif() -if(CMAKE_SYSTEM MATCHES "Windows") +if(CMAKE_SYSTEM_NAME MATCHES "Windows") set(CMAKE_USE_WIN32_THREADS_INIT 1) set(Threads_FOUND TRUE) endif() if(CMAKE_USE_PTHREADS_INIT) - if(CMAKE_SYSTEM MATCHES "HP-UX-*") + if(CMAKE_SYSTEM_NAME MATCHES "HP-UX") # Use libcma if it exists and can be used. It provides more # symbols than the plain pthread library. CMA threads # have actually been deprecated: @@ -162,12 +162,12 @@ if(CMAKE_USE_PTHREADS_INIT) set(CMAKE_USE_PTHREADS_INIT 1) endif() - if(CMAKE_SYSTEM MATCHES "OSF1-V*") + if(CMAKE_SYSTEM MATCHES "OSF1-V") set(CMAKE_USE_PTHREADS_INIT 0) set(CMAKE_THREAD_LIBS_INIT ) endif() - if(CMAKE_SYSTEM MATCHES "CYGWIN_NT*") + if(CMAKE_SYSTEM MATCHES "CYGWIN_NT") set(CMAKE_USE_PTHREADS_INIT 1) set(Threads_FOUND TRUE) set(CMAKE_THREAD_LIBS_INIT ) diff --git a/Modules/FindXMLRPC.cmake b/Modules/FindXMLRPC.cmake index e855050..1491754 100644 --- a/Modules/FindXMLRPC.cmake +++ b/Modules/FindXMLRPC.cmake @@ -77,10 +77,9 @@ if(XMLRPC_FOUND) # Look for -I options. set(XMLRPC_INCLUDE_DIRS) foreach(flag ${XMLRPC_C_CONFIG_CFLAGS}) - if("${flag}" MATCHES "^-I") - string(REGEX REPLACE "^-I" "" DIR "${flag}") - file(TO_CMAKE_PATH "${DIR}" DIR) - set(XMLRPC_INCLUDE_DIRS ${XMLRPC_INCLUDE_DIRS} "${DIR}") + if("${flag}" MATCHES "^-I(.+)") + file(TO_CMAKE_PATH "${CMAKE_MATCH_1}" DIR) + list(APPEND XMLRPC_INCLUDE_DIRS "${DIR}") endif() endforeach() else() @@ -115,13 +114,11 @@ if(XMLRPC_FOUND) set(XMLRPC_LIBRARY_DIRS) set(XMLRPC_LIBRARY_NAMES) foreach(flag ${XMLRPC_C_CONFIG_LIBS}) - if("${flag}" MATCHES "^-L") - string(REGEX REPLACE "^-L" "" DIR "${flag}") - file(TO_CMAKE_PATH "${DIR}" DIR) - set(XMLRPC_LIBRARY_DIRS ${XMLRPC_LIBRARY_DIRS} "${DIR}") - elseif("${flag}" MATCHES "^-l") - string(REGEX REPLACE "^-l" "" NAME "${flag}") - set(XMLRPC_LIBRARY_NAMES ${XMLRPC_LIBRARY_NAMES} "${NAME}") + if("${flag}" MATCHES "^-L(.+)") + file(TO_CMAKE_PATH "${CMAKE_MATCH_1}" DIR) + list(APPEND XMLRPC_LIBRARY_DIRS "${DIR}") + elseif("${flag}" MATCHES "^-l(.+)") + list(APPEND XMLRPC_LIBRARY_NAMES "${CMAKE_MATCH_1}") endif() endforeach() diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake index 75b0076..8cc382c 100644 --- a/Modules/FindZLIB.cmake +++ b/Modules/FindZLIB.cmake @@ -85,7 +85,7 @@ if(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h") # only append a TWEAK version if it exists: set(ZLIB_VERSION_TWEAK "") - if( "${ZLIB_H}" MATCHES "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+).*$") + if( "${ZLIB_H}" MATCHES "ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+)") set(ZLIB_VERSION_TWEAK "${CMAKE_MATCH_1}") set(ZLIB_VERSION_STRING "${ZLIB_VERSION_STRING}.${ZLIB_VERSION_TWEAK}") endif() diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index 3c664e7..45596a0 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -560,7 +560,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") if(WX_LIB_DIR) # If building shared libs, define WXUSINGDLL to use dllimport. - if(WX_LIB_DIR MATCHES ".*[dD][lL][lL].*") + if(WX_LIB_DIR MATCHES "[dD][lL][lL]") set(wxWidgets_DEFINITIONS WXUSINGDLL) DBG_MSG_V("detected SHARED/DLL tree WX_LIB_DIR=${WX_LIB_DIR}") endif() @@ -668,7 +668,7 @@ else() if(_wx_result EQUAL 0) foreach(_opt_name debug static unicode universal) string(TOUPPER ${_opt_name} _upper_opt_name) - if(_wx_selected_config MATCHES ".*${_opt_name}.*") + if(_wx_selected_config MATCHES "${_opt_name}") set(wxWidgets_DEFAULT_${_upper_opt_name} ON) else() set(wxWidgets_DEFAULT_${_upper_opt_name} OFF) diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake index dccb26f..27f8a82 100644 --- a/Modules/FortranCInterface.cmake +++ b/Modules/FortranCInterface.cmake @@ -328,7 +328,7 @@ function(FortranCInterface_VERIFY) # Error if compilers are incompatible. if(NOT FortranCInterface_VERIFIED_${lang} AND NOT quiet) file(READ "${FortranCInterface_BINARY_DIR}/Verify${lang}/output.txt" _output) - string(REGEX REPLACE "\n" "\n " _output "${_output}") + string(REPLACE "\n" "\n " _output "${_output}") message(FATAL_ERROR "The Fortran compiler:\n ${CMAKE_Fortran_COMPILER}\n" "and the ${lang} compiler:\n ${CMAKE_${lang}_COMPILER}\n" diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake index afeb9c5..ceb1db4 100644 --- a/Modules/FortranCInterface/Detect.cmake +++ b/Modules/FortranCInterface/Detect.cmake @@ -69,9 +69,8 @@ if(FortranCInterface_EXE) file(STRINGS "${FortranCInterface_EXE}" _info_strings LIMIT_COUNT 8 REGEX "INFO:[^[]*\\[") foreach(info ${_info_strings}) - if("${info}" MATCHES ".*INFO:symbol\\[([^]]*)\\].*") - string(REGEX REPLACE ".*INFO:symbol\\[([^]]*)\\].*" "\\1" symbol "${info}") - list(APPEND FortranCInterface_SYMBOLS ${symbol}) + if("${info}" MATCHES "INFO:symbol\\[([^]]*)\\]") + list(APPEND FortranCInterface_SYMBOLS ${CMAKE_MATCH_1}) endif() endforeach() elseif(NOT _result) diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index ac649e9..05c2edb 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -509,10 +509,10 @@ function(gp_resolved_file_type original_file file exepath dirs type_var) if(WIN32) string(TOLOWER "$ENV{SystemRoot}" sysroot) - string(REGEX REPLACE "\\\\" "/" sysroot "${sysroot}") + file(TO_CMAKE_PATH "${sysroot}" sysroot) string(TOLOWER "$ENV{windir}" windir) - string(REGEX REPLACE "\\\\" "/" windir "${windir}") + file(TO_CMAKE_PATH "${windir}" windir) if(lower MATCHES "^(${sysroot}/sys(tem|wow)|${windir}/sys(tem|wow)|(.*/)*msvc[^/]+dll)") set(is_system 1) @@ -772,8 +772,8 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa # Convert to a list of lines: # - string(REGEX REPLACE ";" "\\\\;" candidates "${gp_cmd_ov}") - string(REGEX REPLACE "\n" "${eol_char};" candidates "${candidates}") + string(REPLACE ";" "\\;" candidates "${gp_cmd_ov}") + string(REPLACE "\n" "${eol_char};" candidates "${candidates}") # check for install id and remove it from list, since otool -L can include a # reference to itself diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index fc3f87e..df0756b 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -203,7 +203,7 @@ endif() # Make sure the combination of SDK and Deployment Target are allowed if(CMAKE_OSX_DEPLOYMENT_TARGET) - if("${_CMAKE_OSX_SYSROOT_PATH}" MATCHES "^.*/MacOSX([0-9]+\\.[0-9]+)[^/]*\\.sdk") + if("${_CMAKE_OSX_SYSROOT_PATH}" MATCHES "/MacOSX([0-9]+\\.[0-9]+)[^/]*\\.sdk") set(_sdk_ver "${CMAKE_MATCH_1}") elseif("${_CMAKE_OSX_SYSROOT_ORIG}" MATCHES "^macosx([0-9]+\\.[0-9]+)$") set(_sdk_ver "${CMAKE_MATCH_1}") diff --git a/Modules/Platform/OSF1.cmake b/Modules/Platform/OSF1.cmake index 9c3255e..f2ad612 100644 --- a/Modules/Platform/OSF1.cmake +++ b/Modules/Platform/OSF1.cmake @@ -2,7 +2,7 @@ set(CMAKE_DL_LIBS "") if(CMAKE_SYSTEM MATCHES "OSF1-1.[012]") endif() -if(CMAKE_SYSTEM MATCHES "OSF1-1.*") +if(CMAKE_SYSTEM MATCHES "OSF1-1") # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2 set(CMAKE_C_COMPILE_OPTIONS_PIC "-fpic") set(CMAKE_C_COMPILE_OPTIONS_PIE "-fpie") @@ -12,7 +12,7 @@ endif() -if(CMAKE_SYSTEM MATCHES "OSF1-V.*") +if(CMAKE_SYSTEM MATCHES "OSF1-V") set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-expect_unresolved,\\*") # -shared if(CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-Wl,-rpath,") diff --git a/Modules/Platform/OpenBSD.cmake b/Modules/Platform/OpenBSD.cmake index 53cabed..a4f6114 100644 --- a/Modules/Platform/OpenBSD.cmake +++ b/Modules/Platform/OpenBSD.cmake @@ -10,7 +10,7 @@ if(NOT CMAKE_PLATFORM_RUNTIME_PATH) ERROR_QUIET) string(REGEX REPLACE ".*search\\ directories:\\ ([^\n]*).*" "\\1" LDCONFIG_HINTS "${LDCONFIG_HINTS}") - string(REGEX REPLACE ":" ";" + string(REPLACE ":" ";" CMAKE_PLATFORM_RUNTIME_PATH "${LDCONFIG_HINTS}") endif() diff --git a/Modules/Platform/SunOS.cmake b/Modules/Platform/SunOS.cmake index da20f97..aaa79c4 100644 --- a/Modules/Platform/SunOS.cmake +++ b/Modules/Platform/SunOS.cmake @@ -1,4 +1,4 @@ -if(CMAKE_SYSTEM MATCHES "SunOS-4.*") +if(CMAKE_SYSTEM MATCHES "SunOS-4") set(CMAKE_C_COMPILE_OPTIONS_PIC "-PIC") set(CMAKE_C_COMPILE_OPTIONS_PIE "-PIE") set(CMAKE_SHARED_LIBRARY_C_FLAGS "-PIC") diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index 23c4fc0..b1b12d6 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -65,8 +65,8 @@ macro (QT4_MAKE_OUTPUT_FILE infile prefix ext outfile ) else() file(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR} ${infile}) endif() - if(WIN32 AND rel MATCHES "^[a-zA-Z]:") # absolute path - string(REGEX REPLACE "^([a-zA-Z]):(.*)$" "\\1_\\2" rel "${rel}") + if(WIN32 AND rel MATCHES "^([a-zA-Z]):(.*)$") # absolute path + set(rel "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}") endif() set(_outfile "${CMAKE_CURRENT_BINARY_DIR}/${rel}") string(REPLACE ".." "__" _outfile ${_outfile}) diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index 23bf933..fa11585 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -181,7 +181,7 @@ macro(SWIG_ADD_MODULE name language) set(swig_dot_i_sources) set(swig_other_sources) foreach(it ${ARGN}) - if(${it} MATCHES ".*\\.i$") + if(${it} MATCHES "\\.i$") set(swig_dot_i_sources ${swig_dot_i_sources} "${it}") else() set(swig_other_sources ${swig_other_sources} "${it}") diff --git a/Modules/UseVTKConfig40.cmake b/Modules/UseVTKConfig40.cmake index 554b8c4..c5022e4 100644 --- a/Modules/UseVTKConfig40.cmake +++ b/Modules/UseVTKConfig40.cmake @@ -312,7 +312,7 @@ else() if(CMAKE_ANSI_CFLAGS) set(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} ${CMAKE_ANSI_CFLAGS}") endif() - if(CMAKE_SYSTEM MATCHES "OSF1-V.*") + if(CMAKE_SYSTEM MATCHES "OSF1-V") set(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -timplicit_local -no_implicit_include") endif() |