Uncovered while working on https://codereview.qt-project.org/c/qt/qtquick3d/+/282389/31
Sample failure log:
Order of static libraries matters when using the GNU ld linker on linux, and because something fishy is going on with how we make Gui plugins depend on Gui, and Gui depend on Gui plugins, the linker static lib order gets messed up somehow, and thus causes undefined symbol errors at link time.
Can be reproduced with an app that depends on Qt::Gui and Qt::OpenGL in a more simplified manner (small project will be attached shortly)
Upstream CMake issue at https://gitlab.kitware.com/cmake/cmake/-/issues/20604 the minimal project can also be found there.
The minimal project involving qt looks like this:
It appears that this is expected behavior, and that it's the project responsibility to fix it with LINK_INTERFACE_MULTIPLICITY.
But because what we're doing is wrong in the first place (why have target dependency cycles, if there is no cycle in the underlying .cpp code), that's not really the proper fix.