add_dependencies.rst 910 B

1234567891011121314151617181920212223
  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. (but not targets generated by CMake like ``install``).
  11. Dependencies added to an :ref:`imported target <Imported Targets>`
  12. or an :ref:`interface library <Interface Libraries>` are followed
  13. transitively in its place since the target itself does not build.
  14. See the ``DEPENDS`` option of :command:`add_custom_target` and
  15. :command:`add_custom_command` commands for adding file-level
  16. dependencies in custom rules. See the :prop_sf:`OBJECT_DEPENDS`
  17. source file property to add file-level dependencies to object files.