NewLineStyle-ValidArg.cmake 518 B

1234567891011121314151617
  1. set(file_name ${CMAKE_CURRENT_BINARY_DIR}/NewLineStyle.txt)
  2. function(test_eol style in out)
  3. file(WRITE ${file_name} "${in}")
  4. configure_file(${file_name} ${file_name}.out NEWLINE_STYLE ${style})
  5. file(READ ${file_name}.out new HEX)
  6. if(NOT "${new}" STREQUAL "${out}")
  7. message(FATAL_ERROR "No ${style} line endings")
  8. endif()
  9. endfunction()
  10. test_eol(DOS "a\n" "610d0a")
  11. test_eol(WIN32 "b\n" "620d0a")
  12. test_eol(CRLF "c\n" "630d0a")
  13. test_eol(UNIX "d\n" "640a")
  14. test_eol(LF "e\n" "650a")