diff options
author | Rolf Eike Beer <eike@sf-mail.de> | 2014-04-06 19:51:33 (GMT) |
---|---|---|
committer | Rolf Eike Beer <eike@sf-mail.de> | 2014-04-14 16:17:05 (GMT) |
commit | 5bd48ac5348885e15ebb23ea825a1ea777985b97 (patch) | |
tree | 340ac037fe081ef314cb12ecdfca2b229c2f4ea8 | |
parent | 2622bc3f65162bf6d6cb5838da6999f8b5ca75cf (diff) | |
download | CMake-5bd48ac5348885e15ebb23ea825a1ea777985b97.zip CMake-5bd48ac5348885e15ebb23ea825a1ea777985b97.tar.gz CMake-5bd48ac5348885e15ebb23ea825a1ea777985b97.tar.bz2 |
Replace string(REGEX REPLACE) with string(REPLACE) where possible
The simple replacement is much faster.
-rw-r--r-- | Modules/BundleUtilities.cmake | 6 | ||||
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 2 | ||||
-rw-r--r-- | Modules/CMakeDetermineSystem.cmake | 4 | ||||
-rw-r--r-- | Modules/CPackDeb.cmake | 2 | ||||
-rw-r--r-- | Modules/CPackRPM.cmake | 2 | ||||
-rw-r--r-- | Modules/FindCUDA/make2cmake.cmake | 3 | ||||
-rw-r--r-- | Modules/FindCUDA/parse_cubin.cmake | 5 | ||||
-rw-r--r-- | Modules/FindGDAL.cmake | 4 | ||||
-rw-r--r-- | Modules/FindHDF5.cmake | 4 | ||||
-rw-r--r-- | Modules/FindKDE3.cmake | 2 | ||||
-rw-r--r-- | Modules/FindMPI.cmake | 4 | ||||
-rw-r--r-- | Modules/FindPackageMessage.cmake | 2 | ||||
-rw-r--r-- | Modules/FortranCInterface.cmake | 2 | ||||
-rw-r--r-- | Modules/GetPrerequisites.cmake | 8 | ||||
-rw-r--r-- | Modules/Platform/OpenBSD.cmake | 2 | ||||
-rw-r--r-- | Tests/CMakeTests/CheckCMakeTest.cmake | 4 | ||||
-rw-r--r-- | Tests/CTestUpdateCommon.cmake | 4 | ||||
-rw-r--r-- | Tests/CustomCommand/CMakeLists.txt | 4 | ||||
-rw-r--r-- | cmake_uninstall.cmake.in | 2 |
19 files changed, 32 insertions, 34 deletions
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index b896de2..eaddd04 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. @@ -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/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index f977639..73cb92a 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}) 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/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..ad88e6b 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 () diff --git a/Modules/FindCUDA/make2cmake.cmake b/Modules/FindCUDA/make2cmake.cmake index 1b53d17..7194652 100644 --- a/Modules/FindCUDA/make2cmake.cmake +++ b/Modules/FindCUDA/make2cmake.cmake @@ -41,8 +41,7 @@ if (${depend_text} MATCHES ".+") # 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 a42ccab..ddb50de 100644 --- a/Modules/FindCUDA/parse_cubin.cmake +++ b/Modules/FindCUDA/parse_cubin.cmake @@ -39,9 +39,8 @@ file(READ ${input_file} file_text) if (${file_text} MATCHES ".+") - # 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) 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/FindHDF5.cmake b/Modules/FindHDF5.cmake index 2903bf8..1aa5dcf 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() 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/FindMPI.cmake b/Modules/FindMPI.cmake index c8d46ba..b00040f 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/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/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/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/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/Tests/CMakeTests/CheckCMakeTest.cmake b/Tests/CMakeTests/CheckCMakeTest.cmake index 7be7b30..1565394 100644 --- a/Tests/CMakeTests/CheckCMakeTest.cmake +++ b/Tests/CMakeTests/CheckCMakeTest.cmake @@ -9,8 +9,8 @@ function(check_cmake_test_single prefix test testfile) ERROR_VARIABLE stderr RESULT_VARIABLE result ) - string(REGEX REPLACE "\n" "\n out> " out " out> ${stdout}") - string(REGEX REPLACE "\n" "\n err> " err " err> ${stderr}") + string(REPLACE "\n" "\n out> " out " out> ${stdout}") + string(REPLACE "\n" "\n err> " err " err> ${stderr}") if(NOT "${result}" STREQUAL "${${test}-RESULT}") message(FATAL_ERROR "Test ${test} result is [${result}], not [${${test}-RESULT}].\n" diff --git a/Tests/CTestUpdateCommon.cmake b/Tests/CTestUpdateCommon.cmake index 642a618..857c6f5 100644 --- a/Tests/CTestUpdateCommon.cmake +++ b/Tests/CTestUpdateCommon.cmake @@ -9,7 +9,7 @@ function(run_child) ERROR_STRIP_TRAILING_WHITESPACE ) if(FAILED) - string(REGEX REPLACE "\n" "\n " OUTPUT "${OUTPUT}") + string(REPLACE "\n" "\n " OUTPUT "${OUTPUT}") message(FATAL_ERROR "Child failed (${FAILED}), output is\n ${OUTPUT}\n" "Command = [${ARGN}]\n") endif() @@ -108,7 +108,7 @@ function(check_updates build) ${TOP}/${build}/Testing/Temporary/LastUpdate*.log) if(UPDATE_LOG_FILE) file(READ ${UPDATE_LOG_FILE} UPDATE_LOG LIMIT ${max_update_xml_size}) - string(REGEX REPLACE "\n" "\n " UPDATE_LOG "${UPDATE_LOG}") + string(REPLACE "\n" "\n " UPDATE_LOG "${UPDATE_LOG}") set(MSG "${MSG}Update log:\n ${UPDATE_LOG}") else() set(MSG "${MSG}No update log found!") diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index a194a5f..e0854ce 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -367,8 +367,8 @@ endif() foreach(arg ${CHECK_ARGS} "") set(ARG "${arg}") - string(REGEX REPLACE "\\\\" "\\\\\\\\" ARG "${ARG}") - string(REGEX REPLACE "\"" "\\\\\"" ARG "${ARG}") + string(REPLACE "\\" "\\\\" ARG "${ARG}") + string(REPLACE "\"" "\\\"" ARG "${ARG}") set(EXPECTED_ARGUMENTS "${EXPECTED_ARGUMENTS} \"${ARG}\", ") diff --git a/cmake_uninstall.cmake.in b/cmake_uninstall.cmake.in index 7cd7fc1..d81f62a 100644 --- a/cmake_uninstall.cmake.in +++ b/cmake_uninstall.cmake.in @@ -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}") |