@@ -68,6 +68,9 @@ The options are:
6868 order-only dependencies to ensure the byproducts will be
6969 available before their dependents build.
7070
71+ The :ref: `Makefile Generators ` will remove ``BYPRODUCTS `` and other
72+ :prop_sf: `GENERATED ` files during ``make clean ``.
73+
7174``COMMAND ``
7275 Specify the command-line(s) to execute at build time.
7376 If more than one ``COMMAND `` is specified they will be executed in order,
@@ -112,24 +115,42 @@ The options are:
112115 build time.
113116
114117``DEPENDS ``
115- Specify files on which the command depends. If any dependency is
116- an ``OUTPUT `` of another custom command in the same directory
117- (``CMakeLists.txt `` file) CMake automatically brings the other
118+ Specify files on which the command depends. Each argument is converted
119+ to a dependency as follows:
120+
121+ 1. If the argument is the name of a target (created by the
122+ :command: `add_custom_target `, :command: `add_executable `, or
123+ :command: `add_library ` command) a target-level dependency is
124+ created to make sure the target is built before any target
125+ using this custom command. Additionally, if the target is an
126+ executable or library, a file-level dependency is created to
127+ cause the custom command to re-run whenever the target is
128+ recompiled.
129+
130+ 2. If the argument is an absolute path, a file-level dependency
131+ is created on that path.
132+
133+ 3. If the argument is the name of a source file that has been
134+ added to a target or on which a source file property has been set,
135+ a file-level dependency is created on that source file.
136+
137+ 4. If the argument is a relative path and it exists in the current
138+ source directory, a file-level dependency is created on that
139+ file in the current source directory.
140+
141+ 5. Otherwise, a file-level dependency is created on that path relative
142+ to the current binary directory.
143+
144+ If any dependency is an ``OUTPUT `` of another custom command in the same
145+ directory (``CMakeLists.txt `` file), CMake automatically brings the other
118146 custom command into the target in which this command is built.
119147 A target-level dependency is added if any dependency is listed as
120148 ``BYPRODUCTS `` of a target or any of its build events in the same
121149 directory to ensure the byproducts will be available.
122- If ``DEPENDS `` is not specified the command will run whenever
150+
151+ If ``DEPENDS `` is not specified, the command will run whenever
123152 the ``OUTPUT `` is missing; if the command does not actually
124- create the ``OUTPUT `` then the rule will always run.
125- If ``DEPENDS `` specifies any target (created by the
126- :command: `add_custom_target `, :command: `add_executable `, or
127- :command: `add_library ` command) a target-level dependency is
128- created to make sure the target is built before any target
129- using this custom command. Additionally, if the target is an
130- executable or library a file-level dependency is created to
131- cause the custom command to re-run whenever the target is
132- recompiled.
153+ create the ``OUTPUT ``, the rule will always run.
133154
134155 Arguments to ``DEPENDS `` may use
135156 :manual: `generator expressions <cmake-generator-expressions(7)> `.
0 commit comments