diff options
author | Rolf Eike Beer <eike@sf-mail.de> | 2014-04-06 19:30:00 (GMT) |
---|---|---|
committer | Rolf Eike Beer <eike@sf-mail.de> | 2014-04-14 16:16:58 (GMT) |
commit | 2622bc3f65162bf6d6cb5838da6999f8b5ca75cf (patch) | |
tree | d90da340e1dd6e104f8b6c7344f6b38e4d1f03c8 /Modules/FindPkgConfig.cmake | |
parent | 11a6b3d59ad2f75890fcdc42ec13c7a9ee1463f0 (diff) | |
download | CMake-2622bc3f65162bf6d6cb5838da6999f8b5ca75cf.zip CMake-2622bc3f65162bf6d6cb5838da6999f8b5ca75cf.tar.gz CMake-2622bc3f65162bf6d6cb5838da6999f8b5ca75cf.tar.bz2 |
Clean up usage of if(... MATCHES regex) followed string(REGEX REPLACE regex)
The matches have already been calculated and can simply be taken from
CMAKE_MATCH_n variables. This avoids multiple compilations of the same or very
similar regular expressions.
Diffstat (limited to 'Modules/FindPkgConfig.cmake')
-rw-r--r-- | Modules/FindPkgConfig.cmake | 8 |
1 files changed, 4 insertions, 4 deletions
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) |