summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeParseImplicitLinkInfo.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-10-07 12:43:51 (GMT)
committerBrad King <brad.king@kitware.com>2009-10-07 12:43:51 (GMT)
commitfff1c6d275cd24294cb0848b245d166b77e55c12 (patch)
tree9828540eede3588de6265bd028920481f9b0d461 /Modules/CMakeParseImplicitLinkInfo.cmake
parent45d22b48ab047aca5cb41cc7412bf07699b5e58a (diff)
downloadCMake-fff1c6d275cd24294cb0848b245d166b77e55c12.zip
CMake-fff1c6d275cd24294cb0848b245d166b77e55c12.tar.gz
CMake-fff1c6d275cd24294cb0848b245d166b77e55c12.tar.bz2
More robust implicit link line detection regex
The regex used by CMAKE_PARSE_IMPLICIT_LINK_INFO to detect link lines should not match lines that happen to have ".../ld.../..." in them. A linker name should match only as the last component of a path. See issue #9666.
Diffstat (limited to 'Modules/CMakeParseImplicitLinkInfo.cmake')
-rw-r--r--Modules/CMakeParseImplicitLinkInfo.cmake4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake
index 1251f86..b8a681f 100644
--- a/Modules/CMakeParseImplicitLinkInfo.cmake
+++ b/Modules/CMakeParseImplicitLinkInfo.cmake
@@ -26,7 +26,9 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var)
if(CMAKE_LINKER)
get_filename_component(linker ${CMAKE_LINKER} NAME)
endif()
- set(linker_regex "^( *|.*/)(${linker}|ld|collect2)")
+ # Construct a regex to match linker lines. It must match both the
+ # whole line and just the command (argv[0]).
+ set(linker_regex "^( *|.*[/\\])(${linker}|ld|collect2)[^/\\]*( |$)")
set(log "${log} link line regex: [${linker_regex}]\n")
string(REGEX REPLACE "\r?\n" ";" output_lines "${text}")
foreach(line IN LISTS output_lines)