summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-05-17 12:42:07 (GMT)
committerBrad King <brad.king@kitware.com>2013-05-17 12:47:35 (GMT)
commitffda082e652e1fd8a40dbc3c4d7ba11f18c06aac (patch)
tree17c8144bd201a515908e19976499f299d5a06092 /Modules
parentedeabd18e6db5a52b2191ea9d3b09ee8bd090af6 (diff)
downloadCMake-ffda082e652e1fd8a40dbc3c4d7ba11f18c06aac.zip
CMake-ffda082e652e1fd8a40dbc3c4d7ba11f18c06aac.tar.gz
CMake-ffda082e652e1fd8a40dbc3c4d7ba11f18c06aac.tar.bz2
Sanitize linker name to parse implicit link line (#14154)
Teach CMakeParseImplicitLinkInfo to convert the CMAKE_LINKER file name to a regular expression that matches only the original name. Escape special characters like '+' so they are not treated as regex syntax. Extend the ImplicitLinkInfoTest to test handling of a CMAKE_LINKER value with many special characters.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeParseImplicitLinkInfo.cmake1
1 files changed, 1 insertions, 0 deletions
diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake
index fa03630..4724a8c 100644
--- a/Modules/CMakeParseImplicitLinkInfo.cmake
+++ b/Modules/CMakeParseImplicitLinkInfo.cmake
@@ -26,6 +26,7 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
set(linker "CMAKE_LINKER-NOTFOUND")
if(CMAKE_LINKER)
get_filename_component(linker ${CMAKE_LINKER} NAME)
+ string(REGEX REPLACE "([][+.*?()^$])" "\\\\\\1" linker "${linker}")
endif()
# Construct a regex to match linker lines. It must match both the
# whole line and just the command (argv[0]).