From 255df8622bc42c62bd8bc81d2ff2964ef8d6a803 Mon Sep 17 00:00:00 2001 From: Asit Dhal Date: Tue, 22 Dec 2020 13:29:34 +0100 Subject: file(GENERATE): Support new line style Fixes: #19198 --- Help/command/file.rst | 10 ++++++- Help/release/dev/file-generate-new-line-style.rst | 5 ++++ Source/cmFileCommand.cxx | 24 ++++++++++++--- Source/cmGeneratorExpressionEvaluationFile.cxx | 31 +++++++++++++++++-- Source/cmGeneratorExpressionEvaluationFile.h | 3 +- Source/cmMakefile.cxx | 6 ++-- Source/cmMakefile.h | 3 +- .../File_Generate/NewLineStyle-Default.cmake | 35 ++++++++++++++++++++++ .../NewLineStyle-InvalidArg-result.txt | 1 + .../NewLineStyle-InvalidArg-stderr.txt | 5 ++++ .../File_Generate/NewLineStyle-InvalidArg.cmake | 7 +++++ .../File_Generate/NewLineStyle-NoArg-result.txt | 1 + .../File_Generate/NewLineStyle-NoArg-stderr.txt | 4 +++ .../File_Generate/NewLineStyle-NoArg.cmake | 7 +++++ .../RunCMake/File_Generate/NewLineStyle-Unix.cmake | 33 ++++++++++++++++++++ .../File_Generate/NewLineStyle-Win32.cmake | 33 ++++++++++++++++++++ Tests/RunCMake/File_Generate/RunCMakeTest.cmake | 11 +++++++ Tests/RunCMake/File_Generate/VerifyContent.cmake | 4 +++ 18 files changed, 210 insertions(+), 13 deletions(-) create mode 100644 Help/release/dev/file-generate-new-line-style.rst create mode 100644 Tests/RunCMake/File_Generate/NewLineStyle-Default.cmake create mode 100644 Tests/RunCMake/File_Generate/NewLineStyle-InvalidArg-result.txt create mode 100644 Tests/RunCMake/File_Generate/NewLineStyle-InvalidArg-stderr.txt create mode 100644 Tests/RunCMake/File_Generate/NewLineStyle-InvalidArg.cmake create mode 100644 Tests/RunCMake/File_Generate/NewLineStyle-NoArg-result.txt create mode 100644 Tests/RunCMake/File_Generate/NewLineStyle-NoArg-stderr.txt create mode 100644 Tests/RunCMake/File_Generate/NewLineStyle-NoArg.cmake create mode 100644 Tests/RunCMake/File_Generate/NewLineStyle-Unix.cmake create mode 100644 Tests/RunCMake/File_Generate/NewLineStyle-Win32.cmake create mode 100644 Tests/RunCMake/File_Generate/VerifyContent.cmake diff --git a/Help/command/file.rst b/Help/command/file.rst index 76a07f9..41866ca 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -481,7 +481,8 @@ modified. [CONDITION expression] [TARGET target] [FILE_PERMISSIONS ...] - [NO_SOURCE_PERMISSIONS] [USE_SOURCE_PERMISSIONS]) + [NO_SOURCE_PERMISSIONS] [USE_SOURCE_PERMISSIONS] + [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ]) Generate an output file for each build configuration supported by the current :manual:`CMake Generator `. Evaluate @@ -533,6 +534,13 @@ from the input content to produce the output content. The options are: Transfer the file permissions of the original file to the generated file. This option expects INPUT option. +``NEWLINE_STYLE