summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/Syntax/StringBackslash.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-10-22 22:11:22 (GMT)
committerBrad King <brad.king@kitware.com>2013-10-23 13:02:07 (GMT)
commitefcf318f8d56a8bc405fa4af3d4c4b7e8227da3c (patch)
treeb5bd85fc454021be5621fc7b5237e844a796f72e /Tests/RunCMake/Syntax/StringBackslash.cmake
parente48faced66a9036cc49a31686edc8b8e92978349 (diff)
downloadCMake-efcf318f8d56a8bc405fa4af3d4c4b7e8227da3c.zip
CMake-efcf318f8d56a8bc405fa4af3d4c4b7e8227da3c.tar.gz
CMake-efcf318f8d56a8bc405fa4af3d4c4b7e8227da3c.tar.bz2
Add \-continuation to CMake language quoted arguments
Teach the CMake language lexer to treat the \-LF pair terminating a line ending in an odd number of backslashes inside a quoted argument as a continuation. Drop the pair from the returned quoted argument token text. This will allow long lines inside quoted argument strings to be divided across multiple lines in the source file. It will also allow quoted argument text to start on the line after the opening quote. For example, the code: set(x "\ ...") sets variable "x" to the value "..." with no opening newline. Previously an odd number of backslashes at the end of a line inside a quoted argument would put a \-LF pair (or a \-CR pair) literally in the argument. Then the command-argument evaluator would complain that the \-escape sequence is invalid. Therefore this syntax is available to use without changing behavior of valid existing code. Teach the RunCMake.Syntax test to cover cases of quoted arguments with lines ending in \, \\, and \\\. Odd counts are continuations.
Diffstat (limited to 'Tests/RunCMake/Syntax/StringBackslash.cmake')
-rw-r--r--Tests/RunCMake/Syntax/StringBackslash.cmake2
1 files changed, 2 insertions, 0 deletions
diff --git a/Tests/RunCMake/Syntax/StringBackslash.cmake b/Tests/RunCMake/Syntax/StringBackslash.cmake
new file mode 100644
index 0000000..066be96
--- /dev/null
+++ b/Tests/RunCMake/Syntax/StringBackslash.cmake
@@ -0,0 +1,2 @@
+message(FATAL_ERROR "a\\
+b")