diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-01-02 17:10:04 +0100 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-05-24 09:02:45 -0400 |
commit | b983a58bdf1a03a49f2512ac68390888669ac30b (patch) | |
tree | fdef14cc2d264b50e8bb48fbe53e2858852400de /Source/cmFileCommand.h | |
parent | 272431a84ff13eb17cf04389428f57c7fe13e3a2 (diff) | |
download | cmake-b983a58bdf1a03a49f2512ac68390888669ac30b.tar.gz |
file: Add GENERATE command to produce files at generate time
The idea is to write to a temp file which contains generator
expressions, and at generate time, evaluate the generator expressions,
and write the result to a file.
Because executables on Windows are limited in the length of command line
it is possible to use, it is common to write command line arguments to a
file instead and specify the file as a source of arguments.
This new FILE(GENERATE) subcommand allows the use of generator
expressions to create such files so that they can be used with
add_custom_command for example.
Diffstat (limited to 'Source/cmFileCommand.h')
-rw-r--r-- | Source/cmFileCommand.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index 5973fa7324..586fee2ad4 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -88,6 +88,9 @@ public: " file(UPLOAD filename url [INACTIVITY_TIMEOUT timeout]\n" " [TIMEOUT timeout] [STATUS status] [LOG log] [SHOW_PROGRESS])\n" " file(TIMESTAMP filename variable [<format string>] [UTC])\n" + " file(GENERATE OUTPUT output_file\n" + " <INPUT input_file|CONTENT input_content>\n" + " CONDITION expression)\n" "WRITE will write a message into a file called 'filename'. It " "overwrites the file if it already exists, and creates the file " "if it does not exist. (If the file is a build input, use " @@ -231,6 +234,15 @@ public: "it prints status messages, and NO_SOURCE_PERMISSIONS is default. " "Installation scripts generated by the install() command use this " "signature (with some undocumented options for internal use)." + "\n" + "GENERATE will write an <output_file> with content from an " + "<input_file>, or from <input_content>. The output is generated " + "conditionally based on the content of the <condition>. The file is " + "written at CMake generate-time and the input may contain generator " + "expressions. The <condition>, <output_file> and <input_file> may " + "also contain generator expressions. The <condition> must evaluate to " + "either '0' or '1'. The <output_file> must evaluate to a unique name " + "among all configurations and among all invocations of file(GENERATE)." // Undocumented INSTALL options: // - RENAME <name> // - OPTIONAL @@ -269,6 +281,13 @@ protected: bool HandleUploadCommand(std::vector<std::string> const& args); bool HandleTimestampCommand(std::vector<std::string> const& args); + bool HandleGenerateCommand(std::vector<std::string> const& args); + +private: + void AddEvaluationFile(const std::string &inputName, + const std::string &outputExpr, + const std::string &condition, + bool inputIsContent); }; |