QT_QML_OUTPUT_DIRECTORY

默认情况下,QML 模块将创建在此基础输出目录之下。

qt_add_qml_module()命令接受一个名为 `OUTPUT_DIRECTORY ` 的参数,该参数指定 QML 模块的 `qmldir ` 文件、类型信息文件和插件库的创建位置。 如果未使用该参数,则默认值将基于QT_QML_OUTPUT_DIRECTORY 变量(如果已设置)。如果未设置QT_QML_OUTPUT_DIRECTORY ,则默认值取决于后端目标的类型(详情请参阅OUTPUT_DIRECTORY文档)。

当设置了QT_QML_OUTPUT_DIRECTORY 时,默认输出目录将通过将 QML 模块的目标路径(基于模块 URI)追加到QT_QML_OUTPUT_DIRECTORY 来生成。QT_QML_OUTPUT_DIRECTORY 还将被添加到qmllint 和qmlcachegen 工具目标的导入路径中,从而允许它们在同一基目录下查找其他 QML 模块。 这使得项目可以使用与 QML 模块的 URI 结构不完全匹配的源目录结构,或者将一组 QML 模块合并到一个共同的基点之下。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.