• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1add_dependencies
2----------------
3
4Add a dependency between top-level targets.
5
6.. code-block:: cmake
7
8  add_dependencies(<target> [<target-dependency>]...)
9
10Makes a top-level ``<target>`` depend on other top-level targets to
11ensure that they build before ``<target>`` does.  A top-level target
12is one created by one of the :command:`add_executable`,
13:command:`add_library`, or :command:`add_custom_target` commands
14(but not targets generated by CMake like ``install``).
15
16Dependencies added to an :ref:`imported target <Imported Targets>`
17or an :ref:`interface library <Interface Libraries>` are followed
18transitively in its place since the target itself does not build.
19
20.. versionadded:: 3.3
21  Allow adding dependencies to interface libraries.
22
23See the ``DEPENDS`` option of :command:`add_custom_target` and
24:command:`add_custom_command` commands for adding file-level
25dependencies in custom rules.  See the :prop_sf:`OBJECT_DEPENDS`
26source file property to add file-level dependencies to object files.
27