add_dependencies.rst 856 B

12345678910111213141516171819202122
  1. add_dependencies
  2. ----------------
  3. Add a dependency between top-level targets.
  4. ::
  5. add_dependencies(<target> [<target-dependency>]...)
  6. Make a top-level ``<target>`` depend on other top-level targets to
  7. ensure that they build before ``<target>`` does. A top-level target
  8. is one created by one of the :command:`add_executable`,
  9. :command:`add_library`, or :command:`add_custom_target` commands.
  10. Dependencies added to an :ref:`imported target <Imported Targets>`
  11. or an :ref:`interface library <Interface Libraries>` are followed
  12. transitively in its place since the target itself does not build.
  13. See the ``DEPENDS`` option of :command:`add_custom_target` and
  14. :command:`add_custom_command` commands for adding file-level
  15. dependencies in custom rules. See the :prop_sf:`OBJECT_DEPENDS`
  16. source file property to add file-level dependencies to object files.