qt_qml_no_cachegen
此变量在 Qt 6.8.1 中引入。
QT_QML_NO_CACHEGEN
是一个 CMake 变量,可用于禁止将 QML 文件编译为由qt6_add_qml_module() 创建的 QML 目标的字节码或 C++ 代码。
它与设置qt6_add_qml_module() 的NO_CACHEGEN
选项效果相同,但允许在每个目录或项目的基础上这样做。
打开该选项可减少完成联编所需的联编步骤数量,从而缩短开发-调试迭代周期。
要尽量减小应用程序的大小,可关闭该选项,转而使用QT_DISCARD_FILE_CONTENTS删除嵌入到资源系统中的 QML 文件。
可在项目的 CMakeLists.txt 中设置该变量,如下所示:
set(QT_QML_NO_CACHEGEN TRUE) qt_add_qml_module(MyModule URI MyModule VERSION 1.0 ... )
© 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.