summaryrefslogtreecommitdiffstats
path: root/Help
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-03-10 12:24:08 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-03-10 12:27:21 (GMT)
commit268909518f837f4331c758f4ceaec42fbb2def00 (patch)
treefb5b8d981e8a580b836daff3f95629dded26eda6 /Help
parent16ad4e5ce643107c1c397d9cbad21e28b719b62e (diff)
parenta6fee09484dd467028021e2c54e9791f1b6a0cd1 (diff)
downloadCMake-268909518f837f4331c758f4ceaec42fbb2def00.zip
CMake-268909518f837f4331c758f4ceaec42fbb2def00.tar.gz
CMake-268909518f837f4331c758f4ceaec42fbb2def00.tar.bz2
Merge topic 'file-CONFIGURE'
a6fee09484 file: Add CONFIGURE subcommand Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4436
Diffstat (limited to 'Help')
-rw-r--r--Help/command/file.rst40
-rw-r--r--Help/release/dev/file_configure.rst6
2 files changed, 46 insertions, 0 deletions
diff --git a/Help/command/file.rst b/Help/command/file.rst
index 5877d43..5a479d9 100644
--- a/Help/command/file.rst
+++ b/Help/command/file.rst
@@ -19,6 +19,7 @@ Synopsis
file({`WRITE`_ | `APPEND`_} <filename> <content>...)
file({`TOUCH`_ | `TOUCH_NOCREATE`_} [<file>...])
file(`GENERATE`_ OUTPUT <output-file> [...])
+ file(`CONFIGURE`_ OUTPUT <output-file> CONTENT <content> [...])
`Filesystem`_
file({`GLOB`_ | `GLOB_RECURSE`_} <out-var> [...] [<globbing-expr>...])
@@ -484,6 +485,45 @@ generation phase. The output file will not yet have been written when the
``file(GENERATE)`` command returns, it is written only after processing all
of a project's ``CMakeLists.txt`` files.
+.. _CONFIGURE:
+
+.. code-block:: cmake
+
+ file(CONFIGURE OUTPUT output-file
+ CONTENT content
+ [ESCAPE_QUOTES] [@ONLY]
+ [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ])
+
+Generate an output file using the input given by ``CONTENT`` and substitute
+variable values referenced as ``@VAR@`` or ``${VAR}`` contained therein. The
+substitution rules behave the same as the :command:`configure_file` command.
+In order to match :command:`configure_file`'s behavior, generator expressions
+are not supported for both ``OUTPUT`` and ``CONTENT``.
+
+The arguments are:
+
+``OUTPUT <output-file>``
+ Specify the output file name to generate. A relative path is treated with
+ respect to the value of :variable:`CMAKE_CURRENT_BINARY_DIR`. See policy
+ :policy:`CMP0070`.
+ ``<output-file>`` does not support generator expressions.
+
+``CONTENT <content>``
+ Use the content given explicitly as input.
+ ``<content>`` does not support generator expressions.
+
+``ESCAPE_QUOTES``
+ Escape any substituted quotes with backslashes (C-style).
+
+``@ONLY``
+ Restrict variable replacement to references of the form ``@VAR@``.
+ This is useful for configuring scripts that use ``${VAR}`` syntax.
+
+``NEWLINE_STYLE <style>``
+ Specify the newline style for the output file. Specify
+ ``UNIX`` or ``LF`` for ``\n`` newlines, or specify
+ ``DOS``, ``WIN32``, or ``CRLF`` for ``\r\n`` newlines.
+
Filesystem
^^^^^^^^^^
diff --git a/Help/release/dev/file_configure.rst b/Help/release/dev/file_configure.rst
new file mode 100644
index 0000000..35e99c4
--- /dev/null
+++ b/Help/release/dev/file_configure.rst
@@ -0,0 +1,6 @@
+file_configure
+--------------
+
+* The :command:`file(CONFIGURE)` subcommand was created in order replicate the
+ :command:`configure_file` functionality without resorting to a pre-existing
+ file on disk as input. The content is instead passed as a string.