[Interest] What is the right way of creating a static lib that has qml resources with cmake?
Ulf Hermann
ulf.hermann at qt.io
Thu Jan 12 09:36:01 CET 2023
If you state STATIC in qt_add_qml_module (without a qt_add_library or
similar that makes it dynamic) and then it builds a dynamic library,
that's a bug. Please file a report at https://bugreports.qt-project.org
with a minimal reproducer and state the version of Qt you are using.
If it does build a static library but the library doesn't contain
qInitResources, that's on purpose. You need to do the plugin linking
dance which uses additional .o files ("object library" in CMake lingo)
to pull in the resource initialization. That's because linkers
"optimize" the resources out if you don't. We can't do much about this.
See also https://doc.qt.io/qt-6/qt-import-qml-plugins.html and
https://doc.qt.io/qt-6/qqmlengineextensionplugin.html#Q_IMPORT_QML_PLUGIN
best regards,
Ulf
More information about the Interest
mailing list