Hi,

I'm trying to understand how to setup QML modules with CMake and Qt
(static). I've read all the articles and documentation, but I still can't
figure out all the details. Any help is much appreciated.

Here's what I want to achieve:

I have a QML module ExampleA, which implements a couple of items in C++ and
others in QML. Some of the C++ items are also public in C++, i.e. another
C++ module might link against the module and include the headers to derive
from one of the items defined by ExampleA.

I have another QML module ExampleB, which also provides C++ and QML based
items/components. Some of the C++ components are based on ExampleA. Some of
the QML components are also based on ExampleA (C++ or QML).

I have an application that wants to use ExampleB.

My first question is when should I link against the backing target and when
against the plugin target? In the documentation it sounds like that linking
against the plugin target is the right choice, but then do I also need to
manually list Q_IMPORT_QML_PLUGIN in my executable's main.cpp?
I assume that for ExampleB to use the headers of ExampleA it should link
against the backing target rather then the plugin. Or do I need to link
against both in this case? Do I ever need to link against the backing
target for QML only modules defined in CMake?

My other question is related to the qt6_import_qml_plugins CMake function.
I thought this function would be able to scan the QML code and
automatically link against the plugin targets, but for me this never works
with our own QML modules. Is this function limited to Qt's own plugins? In
static Qt builds we also need to manually link against Qt6::QuickControls2,
which sounds like the backing target, which confuses me even more ^^

Best regards,
Marcel
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to