qt6_add_qml_module()
command accepts an
OUTPUT_DIRECTORY
argument which specifies where the QML module's
qmldir
file, typeinfo file and plugin library will be created. When that argument is not used, the default value is based on the
QT_QML_OUTPUT_DIRECTORY
variable, if it is set. If
QT_QML_OUTPUT_DIRECTORY
is not set, the default value depends on the type of backing target (see the
OUTPUT_DIRECTORY
documentation for details).
当
QT_QML_OUTPUT_DIRECTORY
is set, the default output directory will be formed by appending the QML module's
target path
(which is based on the module URI) to
QT_QML_OUTPUT_DIRECTORY
。
QT_QML_OUTPUT_DIRECTORY
will also be added to the import path of the
qmllint
and
qmlcachegen
tooling targets, allowing them to find other QML modules under the same base location. This allows the project to use a source directory structure that doesn't exactly match the URI structure of the QML modules, or to merge sets of QML modules under a common base point.