Inspired by https://codereview.qt-project.org/c/qt/qtbase/+/269386 for the new Qt6 plugin CMake functions.
This overhauls how static plugins are linked and initialized, by not compiling the generated resource file and init function until the very end (the application that ends up consuming the static library). The linker might throw away these objects because they aren't used, so this solution yields better results in my testing.
Static plugins are also now automatically registered, instead of deferring the registration to the applications themselves.
Leaving it as a draft, because I want to make some test cases that might show the problem better.