qt_qml_generate_qmlls_ini

此变量在 Qt 6.7 中引入。

QT_QML_GENERATE_QMLLS_INI 是一个布尔值,用于描述是否调用qt6_add_qml_module()源代码文件夹内生成 文件,并将 CMakeLists.txt 文件放入创建 QML 模块的每个子目录。如果 文件已经存在,则会被覆盖。.qmlls.ini .qmlls.ini

注意: 使用QT_QML_GENERATE_QMLLS_INI 需要 CMake 版本 >= 3.19。

这些.qmlls.ini 文件包含最后配置的编译目录路径,需要通过 QML Language Server来查找用户定义的模块。另请参阅 QML Language ServerQML Language Server 传递构建文件夹的其他方法。

由于此变量用于集成开发环境集成,因此通常不应在项目中设置,而应通过集成开发环境或手动通过

-DQT_QML_GENERATE_QMLLS_INI=ON

传递给 cmake 可执行文件。

警告: QT_QML_GENERATE_QMLLS_INI 生成的文件仅对当前配置有效,版本控制系统应忽略这些文件。对于 Git,可将**/.qmlls.ini 添加到顶层项目.gitignore 中。由于 .qmlls.ini 文件会在定义 QML 模块的所有源代码子目录中生成,因此需要使用 globbing。

© 2025 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.