[Interest] What is the right way of creating a static lib that has qml resources with cmake?

Nuno Santos nuno.santos at imaginando.pt
Thu Jan 12 09:45:22 CET 2023


> On 12 Jan 2023, at 08:36, Ulf Hermann <ulf.hermann at qt.io> wrote:
> 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.

I have been using the following documentation as a guide:


I will try to reproduce the problem basing myself on this. In case I need to submit a bug report what is the category?

> 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

I have also seen this in the previous link and even that I have successfully made it link with the Q_IMPORT_QML_PLUGIN declaration, no resources were available. 

More on this later. I will start from the scratch with an example.

Thank you!



> best regards,
> Ulf

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20230112/7dedb537/attachment.htm>

More information about the Interest mailing list