diff options
author | Brad King <brad.king@kitware.com> | 2021-02-02 13:53:01 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-02-02 13:53:07 (GMT) |
commit | 8387aa20f2c8ba870a8349665e2469f0e064f0b2 (patch) | |
tree | 15d5f1572f67439e161f183bbeaff6fe7ed31621 /Tests/RunCMake/File_Generate/NewLineStyle-Win32.cmake | |
parent | 193cba5d92f6b799119a4e0247e06beda56aa040 (diff) | |
parent | 255df8622bc42c62bd8bc81d2ff2964ef8d6a803 (diff) | |
download | CMake-8387aa20f2c8ba870a8349665e2469f0e064f0b2.zip CMake-8387aa20f2c8ba870a8349665e2469f0e064f0b2.tar.gz CMake-8387aa20f2c8ba870a8349665e2469f0e064f0b2.tar.bz2 |
Merge topic 'issue-19198'
255df8622b file(GENERATE): Support new line style
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Brad King <brad.king@kitware.com>
Merge-request: !5649
Diffstat (limited to 'Tests/RunCMake/File_Generate/NewLineStyle-Win32.cmake')
-rw-r--r-- | Tests/RunCMake/File_Generate/NewLineStyle-Win32.cmake | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Tests/RunCMake/File_Generate/NewLineStyle-Win32.cmake b/Tests/RunCMake/File_Generate/NewLineStyle-Win32.cmake new file mode 100644 index 0000000..394ef75 --- /dev/null +++ b/Tests/RunCMake/File_Generate/NewLineStyle-Win32.cmake @@ -0,0 +1,33 @@ +function(generate_from_file in out) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/file_ip.txt "${in}") + file(GENERATE + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/$<LOWER_CASE:$<CONFIG>>/file_op.txt + INPUT ${CMAKE_CURRENT_BINARY_DIR}/file_ip.txt + NEWLINE_STYLE WIN32 + ) + + add_custom_target(verifyContentFromFile ALL + COMMAND ${CMAKE_COMMAND} + -DgeneratedFile=${CMAKE_CURRENT_BINARY_DIR}/$<LOWER_CASE:$<CONFIG>>/file_op.txt + -DexpectedContent=${out} + -P "${CMAKE_CURRENT_SOURCE_DIR}/VerifyContent.cmake" + ) +endfunction() + +function(generate_from_content in out) + file(GENERATE + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/$<LOWER_CASE:$<CONFIG>>/content_op.txt + CONTENT ${in} + NEWLINE_STYLE WIN32 + ) + + add_custom_target(verifyContentFromContent ALL + COMMAND ${CMAKE_COMMAND} + -DgeneratedFile=${CMAKE_CURRENT_BINARY_DIR}/$<LOWER_CASE:$<CONFIG>>/content_op.txt + -DexpectedContent=${out} + -P "${CMAKE_CURRENT_SOURCE_DIR}/VerifyContent.cmake" + ) +endfunction() + +generate_from_file("a" "610d0a") # 62->b, 0d0a->\r\n +generate_from_content("a" "610d0a") |