summaryrefslogtreecommitdiff
path: root/Tests/RegexEscapeString.cmake
diff options
context:
space:
mode:
authorModestas Vainius <modax@debian.org>2013-06-03 16:42:12 +0200
committerRolf Eike Beer <eike@sf-mail.de>2013-06-03 16:51:21 +0200
commitc9b75dcd734e2dd09eadbd9b16a6497bae95941c (patch)
treebc56930440882ccfb239573521f554bf438fe44d /Tests/RegexEscapeString.cmake
parent5dd8c01429da90a7417b72f17e784cc98f70f57c (diff)
downloadcmake-c9b75dcd734e2dd09eadbd9b16a6497bae95941c.tar.gz
Fix test failures caused by regexp-sensitive characters in the build paths
Checkout [1] as an example of the test failures. In that particular cases, the failures is caused by the plus sign in the path being pass unescaped (buildd-cmake_2.8.9-1~bpo60+1-armel-3Lvkef) to the regexp. In addition to failures in the log, the following new tests also fail in 2.8.11: 243 - CTestTestMemcheckUnknown (Failed) 244 - CTestTestMemcheckUnknownQuoted (Failed) 248 - CTestTestMemcheckDummyValgrindFailPre (Failed) 249 - CTestTestMemcheckDummyValgrindFailPost (Failed) 250 - CTestTestMemcheckDummyPurify (Failed) 251 - CTestTestMemcheckDummyBC (Failed) 253 - CMake.List (Failed) [1] https://buildd.debian.org/status/fetch.php?pkg=cmake&arch=armel&ver=2.8.9-1~bpo60%2B1&stamp=1369243896
Diffstat (limited to 'Tests/RegexEscapeString.cmake')
-rw-r--r--Tests/RegexEscapeString.cmake4
1 files changed, 4 insertions, 0 deletions
diff --git a/Tests/RegexEscapeString.cmake b/Tests/RegexEscapeString.cmake
new file mode 100644
index 0000000000..92aed17b1f
--- /dev/null
+++ b/Tests/RegexEscapeString.cmake
@@ -0,0 +1,4 @@
+macro(REGEX_ESCAPE_STRING _OUT _IN)
+ # Escape special regex metacharacters with a backslash
+ string(REGEX REPLACE "([$^.[|*+?()]|])" "\\\\\\1" ${_OUT} "${_IN}")
+endmacro()