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/CMakeParseImplicitLinkInfo.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/CMakeParseImplicitLinkInfo.cmake')
-rw-r--r-- | Modules/CMakeParseImplicitLinkInfo.cmake | 10 |
1 files changed, 4 insertions, 6 deletions
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() |