diff options
author | Brad King <brad.king@kitware.com> | 2013-10-14 17:54:19 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-10-17 13:07:00 (GMT) |
commit | a8c652342f0e4dcaf933ecb0ce164b44d4997ae4 (patch) | |
tree | f95ad82b3bbadfbfde14b1642fa88b385c322373 /Tests/RunCMake/Syntax | |
parent | dbd933365ec780d27ab7c0dfba30dc1af1094607 (diff) | |
download | CMake-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')
-rw-r--r-- | Tests/RunCMake/Syntax/.gitattributes | 1 | ||||
-rw-r--r-- | Tests/RunCMake/Syntax/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/Syntax/StringCRLF-stderr.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/Syntax/StringCRLF.cmake | 6 |
4 files changed, 9 insertions, 0 deletions
diff --git a/Tests/RunCMake/Syntax/.gitattributes b/Tests/RunCMake/Syntax/.gitattributes index fc9ebff..567121f 100644 --- a/Tests/RunCMake/Syntax/.gitattributes +++ b/Tests/RunCMake/Syntax/.gitattributes @@ -1 +1,2 @@ CommandTabs.cmake whitespace=-tab-in-indent +StringCRLF.cmake whitespace=cr-at-eol -crlf diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake index d1a15c8..1399d8b 100644 --- a/Tests/RunCMake/Syntax/RunCMakeTest.cmake +++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake @@ -13,6 +13,7 @@ run_cmake(CommandError0) run_cmake(CommandError1) run_cmake(String0) run_cmake(String1) +run_cmake(StringCRLF) run_cmake(StringNoSpace) run_cmake(OneLetter) run_cmake(Unquoted0) diff --git a/Tests/RunCMake/Syntax/StringCRLF-stderr.txt b/Tests/RunCMake/Syntax/StringCRLF-stderr.txt new file mode 100644 index 0000000..7aef26e --- /dev/null +++ b/Tests/RunCMake/Syntax/StringCRLF-stderr.txt @@ -0,0 +1 @@ +CRLF->LF worked 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()
|