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)
This commit is contained in:
Brad King 2014-04-15 10:22:34 -04:00 committed by CMake Topic Stage
commit 18aaed77c0
76 changed files with 192 additions and 224 deletions

View File

@ -34,20 +34,20 @@ else()
endif()
#silence duplicate symbol warnings on AIX
if(CMAKE_SYSTEM MATCHES "AIX.*")
if(CMAKE_SYSTEM_NAME MATCHES "AIX")
if(NOT CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -bhalt:5 ")
endif()
endif()
if(CMAKE_SYSTEM MATCHES "IRIX.*")
if(CMAKE_SYSTEM_NAME MATCHES "IRIX")
if(NOT CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-woff84 -no_auto_include")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-woff15")
endif()
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()

View File

@ -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}")

View File

@ -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()

View File

@ -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

View File

@ -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()

View File

@ -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 ()

View File

@ -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 ()

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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}.")

View File

@ -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")

View File

@ -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)

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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 ":"

View File

@ -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()

View File

@ -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}}")

View File

@ -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}")
if("x${opt}" MATCHES "^xREGEX:([^:/]+)$")
list(APPEND associated_regex "${CMAKE_MATCH_1}")
elseif(opt STREQUAL ":")
# Activate series matching.
set(series_option "${opt}")

View File

@ -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}")

View File

@ -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()

View File

@ -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()

View File

@ -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 ()

View File

@ -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()

View File

@ -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)

View File

@ -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})

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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

View File

@ -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

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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)

View File

@ -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}"
)

View File

@ -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()

View File

@ -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")

View File

@ -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()

View File

@ -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 ()

View File

@ -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()

View File

@ -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 ()

View File

@ -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.

View File

@ -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()

View File

@ -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)

View File

@ -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()

View File

@ -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)

View File

@ -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()

View File

@ -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}")

View File

@ -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 )

View File

@ -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()

View File

@ -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()

View File

@ -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)

View File

@ -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"

View File

@ -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)

View File

@ -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

View File

@ -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}")

View File

@ -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,")

View File

@ -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()

View File

@ -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")

View File

@ -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})

View File

@ -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}")

View File

@ -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()

View File

@ -30,8 +30,8 @@ if(EXISTS ${CMake_SOURCE_DIR}/.git/HEAD)
elseif(EXISTS ${CMake_SOURCE_DIR}/CVS/Repository)
file(READ ${CMake_SOURCE_DIR}/CVS/Repository repo)
set(branch "")
if("${repo}" MATCHES "\\.git/")
string(REGEX REPLACE ".*\\.git/([^\r\n]*).*" "-\\1" branch "${repo}")
if("${repo}" MATCHES "\\.git/([^\r\n]*)")
set(branch "${CMAKE_MATCH_1}")
endif()
set(CMake_VERSION_SOURCE "cvs${branch}")
endif()

View File

@ -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")

View File

@ -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"

View File

@ -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()

View File

@ -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!")

View File

@ -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()

View File

@ -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()

View File

@ -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}\",
")

View File

@ -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)

View File

@ -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()

View File

@ -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()

View File

@ -3,7 +3,7 @@ if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
endif()
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
string(REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
if(EXISTS "$ENV{DESTDIR}${file}")