[Interest] Require a qt_finalize_target() call in CMake user projects that use a static Qt

Marius Kittler mkittler at suse.de
Wed May 5 13:32:18 CEST 2021


to me the most important point is that I can still stay in control over which 
plugins are linked against and which not. At best I can turn off pulling 
plugins automatically completely to avoid bloating my applications and keep my 
own build system logic for deciding what plugins are needed.

I must say that Qt 6 made this harder (in contrast to my heavily patched Qt 5 
version). I'm not quite sure how to disable pulling plugins automatically and 
without https://github.com/Martchus/qtutilities/commit/
7183ec501c90bfc38538fd7a810533b8a8a78cff Qt's CMake modules pulled in tons of 
unwanted plugins automatically.

It is problematic that Qt 6 (and I suppose also recent Qt 5 versions) seemed 
to introduce new features regarding static plugins in CMake but the 
documentation wasn't extended, e.g. https://doc.qt.io/qt-6/plugins-howto.html#static-plugins looks is still only covering qmake. I have already 
found https://doc.qt.io/qt-6/qt-import-plugins.html but it doesn't show how to 
disable the automatic inclusion completely and the variable 
`QT_SKIP_AUTO_QML_PLUGIN_INCLUSION` I've had to use in the mentioned commit 
wasn't explained at all.

To give you feedback on `qt_finalize_target()`: I would have no problem with 
an extra call and requiring an up-to-date CMake installation but don't forget 
to update the documentation and keep the use case of linking against plugins 
manually in mind.

By the way, thanks for making this part of Qt's build system better! I've 
mentioned that I had to patch Qt 5 a lot (so it can cope with all static 
dependencies correctly when using CMake) and with Qt 6 all of this is not 
necessary anymore. So despite the mentioned problems that's actually already a 
huge improvement.

Best Regards

More information about the Interest mailing list