qt_qml_no_cachegen

この変数は Qt 6.8.1 で導入されました。

QT_QML_NO_CACHEGEN は CMake 変数で、qt6_add_qml_module() で作成された QML ターゲットに対して、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.