summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2022-01-08 11:04:27 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2022-01-11 11:51:11 (GMT)
commit8a3aac990e4fa5ee9d235b9880cded1c7159964e (patch)
treeac988fc0e2c694834aed42f294be2cae58b29ac3
parente9684673540660ba63a8ab49a9c68d0f69395bfa (diff)
downloadCMake-8a3aac990e4fa5ee9d235b9880cded1c7159964e.zip
CMake-8a3aac990e4fa5ee9d235b9880cded1c7159964e.tar.gz
CMake-8a3aac990e4fa5ee9d235b9880cded1c7159964e.tar.bz2
Help: add_custom_command: describes depfile format
-rw-r--r--Help/command/add_custom_command.rst45
1 files changed, 42 insertions, 3 deletions
diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst
index b45a079..f07b4a6 100644
--- a/Help/command/add_custom_command.rst
+++ b/Help/command/add_custom_command.rst
@@ -271,9 +271,48 @@ The options are:
``DEPFILE``
.. versionadded:: 3.7
- Specify a ``.d`` depfile which holds dependencies for the custom command.
- It is usually emitted by the custom command itself. This keyword may only
- be used if the generator supports it, as detailed below.
+ Specify a depfile which holds dependencies for the custom command. It is
+ usually emitted by the custom command itself. This keyword may only be used
+ if the generator supports it, as detailed below.
+
+ The expected format, compatible with what is generated by ``gcc`` with the
+ option ``-M``, is independent of the generator or platform.
+
+ The formal syntax, as specified using
+ `BNF <https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form>`_ notation with
+ the regular extensions, is the following:
+
+ .. raw:: latex
+
+ \begin{small}
+
+ .. productionlist:: depfile
+ depfile: `rule`*
+ rule: `targets` (`colon` `dependencies`?)? `eol`
+ colon: `separator`* ':' space `separator`*
+ targets: `target` (`separator` `target`)*
+ target: `pathname`
+ dependencies: `dependency` (`separator` `dependency`)*
+ dependency: `pathname`
+ separator: (space | line_continue)+
+ line_continue: '\' `eol`
+ space: ' ' | '\t'
+ pathname: `character`+
+ character: `std_character` | `dollar` | `hash` | `whitespace`
+ std_character: <any character except '$', '#' or ' '>
+ dollar: '$$'
+ hash: '\#'
+ whitespace: '\ '
+ eol: '\r'? '\n'
+
+ .. raw:: latex
+
+ \end{small}
+
+ .. note::
+
+ As part of ``pathname``, any slash and backslash is interpreted as
+ a directory separator.
.. versionadded:: 3.7
The :generator:`Ninja` generator supports ``DEPFILE`` since the keyword