summaryrefslogtreecommitdiffstats
path: root/Help
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-03-06 14:19:55 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-03-06 14:20:02 (GMT)
commit05e647759daf4d2d11f5cd9712678966a0a6a663 (patch)
tree3ca3447dc31762a93241acad2704203633e66cd3 /Help
parent995b122471943461ca8bf6e89e894464fef5f05c (diff)
parent785f2b2df1991e8baec39f73afe09acfb88be44f (diff)
downloadCMake-05e647759daf4d2d11f5cd9712678966a0a6a663.zip
CMake-05e647759daf4d2d11f5cd9712678966a0a6a663.tar.gz
CMake-05e647759daf4d2d11f5cd9712678966a0a6a663.tar.bz2
Merge topic 'doc-add_custom_command-depends'
785f2b2df1 Help: Clarify add_custom_command DEPENDS conversion to file paths Acked-by: Kitware Robot <kwrobot@kitware.com> Reviewed-by: Ben Boeckel <ben.boeckel@kitware.com> Merge-request: !4434
Diffstat (limited to 'Help')
-rw-r--r--Help/command/add_custom_command.rst44
1 files changed, 30 insertions, 14 deletions
diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst
index 576ed5b..69d6e9a 100644
--- a/Help/command/add_custom_command.rst
+++ b/Help/command/add_custom_command.rst
@@ -112,26 +112,42 @@ The options are:
build time.
``DEPENDS``
- Specify files on which the command depends. Entries in the ``DEPENDS``
- argument list which may also be target names are assumed to be target names,
- so only entries which contain a path separator are detected as file paths.
+ Specify files on which the command depends. Each argument is converted
+ to a dependency as follows:
+
+ 1. If the argument is the name of a target (created by the
+ :command:`add_custom_target`, :command:`add_executable`, or
+ :command:`add_library` command) a target-level dependency is
+ created to make sure the target is built before any target
+ using this custom command. Additionally, if the target is an
+ executable or library, a file-level dependency is created to
+ cause the custom command to re-run whenever the target is
+ recompiled.
+
+ 2. If the argument is an absolute path, a file-level dependency
+ is created on that path.
+
+ 3. If the argument is the name of a source file that has been
+ added to a target or on which a source file property has been set,
+ a file-level dependency is created on that source file.
+
+ 4. If the argument is a relative path and it exists in the current
+ source directory, a file-level dependency is created on that
+ file in the current source directory.
+
+ 5. Otherwise, a file-level dependency is created on that path relative
+ to the current binary directory.
+
If any dependency is an ``OUTPUT`` of another custom command in the same
- directory (``CMakeLists.txt`` file) CMake automatically brings the other
+ directory (``CMakeLists.txt`` file), CMake automatically brings the other
custom command into the target in which this command is built.
A target-level dependency is added if any dependency is listed as
``BYPRODUCTS`` of a target or any of its build events in the same
directory to ensure the byproducts will be available.
- If ``DEPENDS`` is not specified the command will run whenever
+
+ If ``DEPENDS`` is not specified, the command will run whenever
the ``OUTPUT`` is missing; if the command does not actually
- create the ``OUTPUT`` then the rule will always run.
- If ``DEPENDS`` specifies any target (created by the
- :command:`add_custom_target`, :command:`add_executable`, or
- :command:`add_library` command) a target-level dependency is
- created to make sure the target is built before any target
- using this custom command. Additionally, if the target is an
- executable or library a file-level dependency is created to
- cause the custom command to re-run whenever the target is
- recompiled.
+ create the ``OUTPUT``, the rule will always run.
Arguments to ``DEPENDS`` may use
:manual:`generator expressions <cmake-generator-expressions(7)>`.