- Qt 6.8
- Qt Qml
- QTP0005
- Qt 6.8.1 Reference Documentation

# QTP0005

qt_add_qml_module's DEPENDENCIES argument accepts targets

This policy was introduced in Qt 6.8. It allows passing targets to qt_add_qml_module() `DEPENDENCIES`, `IMPORTS`, `OPTIONAL_IMPORTS` and `DEFAULT_IMPORTS`.

Enabling this policy means that the arguments which are passed to the key words can be prefixed with TARGET, and are then treated as a target name.

The `OLD` behavior of this policy is that the "TARGET name" is treated as two URIs, "TARGET" and "name".

The `NEW` behavior of this policy is that `TARGET` is considered a keyword, and the URI is extracted from the target which follows next. It is a hard error if the name following `TARGET` does not name a target, or if that target does not correspond to a QML module.

In both the `NEW` and the `OLD` behavior it is possible to specify a module version by appending a slash and the version. See Declaring module dependencies for more details.

Qt 6.8 issues warnings if you pass a URI to `DEPENDENCIES` which coincides with a target name. Use the qt_policy command to suppress the warning by explicitly setting the policy to `OLD` or `NEW`.

Note: The `OLD` behavior of a policy is deprecated, and may be removed in the future.

See also qt_policy, qt_standard_project_setup(), qt_cmake_policies, and qt_add_qml_module.