summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/Syntax/StringCRLF.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-10-14 17:54:19 (GMT)
committerBrad King <brad.king@kitware.com>2013-10-17 13:07:00 (GMT)
commita8c652342f0e4dcaf933ecb0ce164b44d4997ae4 (patch)
treef95ad82b3bbadfbfde14b1642fa88b385c322373 /Tests/RunCMake/Syntax/StringCRLF.cmake
parentdbd933365ec780d27ab7c0dfba30dc1af1094607 (diff)
downloadCMake-a8c652342f0e4dcaf933ecb0ce164b44d4997ae4.zip
CMake-a8c652342f0e4dcaf933ecb0ce164b44d4997ae4.tar.gz
CMake-a8c652342f0e4dcaf933ecb0ce164b44d4997ae4.tar.bz2
cmListFileLexer: Convert CRLF -> LF newlines explicitly
Read input files in binary mode instead of text mode and convert CRLF newlines to LF newlines explicitly in our own buffer. This is necessary to read CMake source files with CRLF newlines on platforms whose C runtime libraries do not transform newlines in text mode. For example, a Cygwin or Linux binary may not transform CRLF -> LF in files read from a Windows filesystem. Perform the conversion ourselves to ensure that multi-line string literals in CMake source files have LF newlines everywhere.
Diffstat (limited to 'Tests/RunCMake/Syntax/StringCRLF.cmake')
-rw-r--r--Tests/RunCMake/Syntax/StringCRLF.cmake6
1 files changed, 6 insertions, 0 deletions
diff --git a/Tests/RunCMake/Syntax/StringCRLF.cmake b/Tests/RunCMake/Syntax/StringCRLF.cmake
new file mode 100644
index 0000000..d20cfea
--- /dev/null
+++ b/Tests/RunCMake/Syntax/StringCRLF.cmake
@@ -0,0 +1,6 @@
+if("a
+b" STREQUAL "a\nb")
+ message("CRLF->LF worked")
+else()
+ message(FATAL_ERROR "CRLF->LF failed")
+endif()