cmake/Help/prop_tgt/AUTOGEN_TARGET_DEPENDS.rst

47 lines
1.8 KiB
ReStructuredText
Raw Normal View History

2014-08-03 19:52:23 +02:00
AUTOGEN_TARGET_DEPENDS
----------------------
2024-04-14 22:45:38 +02:00
Additional target dependencies of the corresponding :ref:`<ORIGIN>_autogen`
target.
.. note::
If Qt 5.15 or later is used and the generator is either :generator:`Ninja`
or :ref:`Makefile Generators`, additional target dependencies are added to
the :ref:`<ORIGIN>_autogen_timestamp_deps` target instead of the
:ref:`<ORIGIN>_autogen` target.
2014-08-03 19:52:23 +02:00
2018-04-23 21:13:27 +02:00
Targets which have their :prop_tgt:`AUTOMOC` or :prop_tgt:`AUTOUIC` property
2024-04-14 22:45:38 +02:00
``ON`` have a corresponding :ref:`<ORIGIN>_autogen` target which generates
``moc`` and ``uic`` files. As this :ref:`<ORIGIN>_autogen` target is created
at generate-time, it is not possible to define dependencies of it using e.g.
:command:`add_dependencies`. Instead the ``AUTOGEN_TARGET_DEPENDS`` target
property can be set to a :ref:`;-list <CMake Language Lists>` of additional
dependencies for the :ref:`<ORIGIN>_autogen` target. Dependencies can be target
names or file names.
In total the dependencies of the :ref:`<ORIGIN>_autogen` target are composed
from
2019-11-11 23:01:05 +01:00
- forwarded origin target dependencies
(enabled by default via :prop_tgt:`AUTOGEN_ORIGIN_DEPENDS`)
2023-05-23 16:38:00 +02:00
- additional user defined dependencies from ``AUTOGEN_TARGET_DEPENDS``
2014-08-03 19:52:23 +02:00
See the :manual:`cmake-qt(7)` manual for more information on using CMake
with Qt.
2018-04-23 21:13:27 +02:00
Use cases
^^^^^^^^^
If :prop_tgt:`AUTOMOC` or :prop_tgt:`AUTOUIC` depends on a file that is either
- a :prop_sf:`GENERATED` non C++ file (e.g. a :prop_sf:`GENERATED` ``.json``
or ``.ui`` file) or
- a :prop_sf:`GENERATED` C++ file that isn't recognized by :prop_tgt:`AUTOMOC`
and :prop_tgt:`AUTOUIC` because it's skipped by :prop_sf:`SKIP_AUTOMOC`,
:prop_sf:`SKIP_AUTOUIC`, :prop_sf:`SKIP_AUTOGEN` or :policy:`CMP0071` or
2019-11-11 23:01:05 +01:00
- a file that isn't in the origin target's sources
2018-04-23 21:13:27 +02:00
2023-05-23 16:38:00 +02:00
it must be added to ``AUTOGEN_TARGET_DEPENDS``.