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

Nuno Santos nuno.santos at imaginando.pt
Wed Jan 11 12:51:12 CET 2023


Hi,

I’m trying to port a project from qmake to cmake.

The project typically consists in a shared library, common to all apps, a common library, common to a specific and its variants.

I still have doubts on how to create this shared static library with the qml resources built in.

qt_add_qml_module(shared STATIC
    URI shared
    VERSION 1.0
    QML_FILES ${SHARED_QML_FILES}
    SOURCES ${SHARED_SOURCE_FILES}
    #NO_LINT
    #NO_CACHEGEN
)
qt_add_resources(shared "shared_qml" PREFIX "/" BASE resources FILES ${SHARED_QML_FILES})

With the following approach two libs are created:

libshared.a and libsharedplugin.a

I just want to have a single target called libshared.a with all the qml resources embedded.

What am I missing?

Thanks!

Best,

Nuno


More information about the Interest mailing list