- Qt 6.11
- Qt Qml
- CMake Integration for QML
- CMake Policies for QML
- QTP0001
- Qt 6.11.1 Reference Documentation

CMake Policies for QML ◦ QTP0004

# QTP0001

':/qt/qml/' is the default resource prefix for QML modules.

This policy was introduced in Qt 6.5. It changes where qt_add_qml_module() stores QML resources in the resource system.

Enabling this policy ensures that your QML module is placed under a default import path, and its types can be found without manual calls to QQmlEngine::addImportPath.

The `OLD` behavior of this policy is that, the `RESOURCE_PREFIX` argument for `qt_add_qml_module()` defaults to `"/"`.

The `NEW` behavior of this policy is that the `RESOURCE_PREFIX` argument for `qt_add_qml_module()` defaults to `"/qt/qml/"`. The new behavior ensures that modules are put into the QML Import Path and can be found without further setup.

Qt 6.5 issues warnings if you do not pass any of the following arguments to the `qt_add_qml_module` command: `RESOURCE_PREFIX`, `NO_RESOURCE_TARGET_PATH`. 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.

CMake Policies for QML ◦ QTP0004