Debian Codegraph @

Tests/RunCMake/File_Configure/NewLineStyle-ValidArg.cmake

raw
1 set(file_name ${CMAKE_CURRENT_BINARY_DIR}/NewLineStyle.txt)
2
3 function(test_eol style in out)
4 if (style)
5 set(newline_stle NEWLINE_STYLE ${style})
6 endif()
7 file(CONFIGURE
8 OUTPUT ${file_name}
9 CONTENT "@in@"
10 ${newline_stle}
11 )
12 file(READ ${file_name} new HEX)
13 if(NOT "${new}" STREQUAL "${out}")
14 message(FATAL_ERROR "No ${style} line endings")
15 endif()
16 endfunction()
17
18 test_eol(DOS "a" "610d0a")
19 test_eol(WIN32 "b" "620d0a")
20 test_eol(CRLF "c" "630d0a")
21
22 test_eol(UNIX "d" "640a")
23 test_eol(LF "e" "650a")
24
25 if (WIN32)
26 test_eol("" "a\nb" "610d0a62")
27 elseif(UNIX)
28 test_eol("" "a\nb" "610a62")
29 endif()