[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 17:29:09 CET 2023


I focus on the practical side of things because I can’t simply know everything.

With qmake I only had to do this:

CONFIG += staticlib
RESOURCES += $$PWD/resources/resources.qrc

And all the resources listed in the .qrc file would be available in the final lib.

This is what I’m trying to achieve with cmake.



> On 12 Jan 2023, at 14:18, Thiago Macieira <thiago.macieira at intel.com> wrote:
> On Thursday, 12 January 2023 00:36:01 PST Ulf Hermann via Interest wrote:
>> That's because linkers "optimize" the resources out if you don't.
> Strictly speaking, this should read "linkers don't include stuff you don't 
> need". If you don't need a particular .o from the static library, it won't be 
> included in the output.
> "Need" is defined as "provides a symbol that is undefined in the linker at this 
> point".
>> We can't do much about this.
> Yes, there is. There's -Wl,--whole-archive for the Unix linkers. This should 
> solve the problem for everyone except MSVC users.
> -- 
> Thiago Macieira - thiago.macieira (AT) intel.com
>  Cloud Software Architect - Intel DCAI Cloud Engineering
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest

More information about the Interest mailing list