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

Nuno Santos nuno.santos at imaginando.pt
Fri Jan 20 11:56:13 CET 2023


Hi Robert,

I’m not talking about shared libraries. I’m talking about static libraries. While they are shared between several applications I link them statically with the final application. This is a requirement for me. This was possible to do with Qt 5 and qmake. As simple as that:

TEMPLATE = lib
CONFIG += staticlib
RESOURCES += resources.qrc

A couple of bug reports have been opened regarding this topics:

https://bugreports.qt.io/browse/QTBUG-110110

https://bugreports.qt.io/browse/QTBUG-110243

And if Qt is switching to a more evolved build system that will replace qmake, it does not make sense that this is not supported. 

Thank you!

Best regards,

Nuno

> On 20 Jan 2023, at 10:00, coroberti <coroberti at gmail.com> wrote:
> 
> On Mon, Jan 16, 2023 at 10:07 AM Nuno Santos <nuno.santos at imaginando.pt <mailto:nuno.santos at imaginando.pt>> wrote:
>> 
>> Good morning Ulf,
>> 
>> Ok, so this this the news Qt 6 / CMake approach to things and we can’t avoid it right?
>> 
>> However, as it is, its buggy. I will upload my last week example to https://bugreports.qt.io/browse/QTBUG-110110
>> 
>> Because I’ve been struggling with this for days without having success. I’ve also shared this example with another top level Qt developer who couldn’t figure it out as well. I’ve only tested on Mac so far. At the time being this is a full blocker.
>> 
>> Thanks for your help and insights.
>> 
>> Have an excellent week!
>> 
>> Best regards,
>> 
>> Nuno
> 
> Dear Nuno,
> On Mac, unlike on Windows, there's a concept of an app bundle.
> The Qt shared libraries are copied by macdeployqt to the app bundle as
> shared libraries called frameworks.
> 
> Thus, shared libraries are coming together with the exe and are easily
> accessible.
> 
> Perhaps, at least on Mac you do not need static linking and can rather
> safely use the dynamic linking
> to the libs within the bundle?
> 
> Thanks.
> 
> Kind regards,
> Robert Iakobashvili
> ............................

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20230120/2305233d/attachment.htm>


More information about the Interest mailing list