A static build of Qt with QT_BUILD_TESTS=ON would fail with errors like
this:
FAILED: tests/auto/corelib/io/qprocess/testProcessEcho2/testProcessEcho2
undefined reference to `qRegisterResourceData(...)'
We create object libraries for resources. In this case, for the
mimetypes of QtCore.
For static builds we added the object files to INTERFACE_LINK_LIBRARIES
of the Qt module the resource belongs to:
target_link_libraries(Core INTERFACE
"$<TARGET_OBJECTS:$<TARGET_NAME:${resource_target}>>")
That is, however, a problem for projects that link only against QtCore,
like testProcessEcho2 above. On the linker command line Qt6Core.a is
before qrc_mimetypes.cpp.o and that doesn't work, because the latter
needs symbols of the former.
To have the resource object files before any other libraries on the
linker's command line, we now treat them as source files.
Pick-to: 6.0
Fixes: QTBUG-90582
Change-Id: Ia2786beb5f7c2eba194e8f00ae8785572df1cf6e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>