When linking against Qt with MinGW, libmingw32.a must come before
libQt6EntryPointImplementation.a on the linker command line. Otherwise
the linker cannot find the WinMain symbol that's defined in the
EntryPointImplementation library.
Under certain circumstances, mingw32 was linked after
EntryPointImplementation. To reliably ensure the order of said
libraries, we introduce the imported library EntryPointMinGW32. This
target represents libmingw32.a and links against EntryPointImplementation.
The link dependencies look like this:
EntryPointPrivate -> EntryPointMinGW32 -> EntryPointImplementation
The imported library EntryPointMinGW32 is defined in a separate .cmake
file which is included by both src/entrypoint/CMakeLists.txt and
Qt6EntryPointConfig.cmake. This is needed, because the consumer outside
of Qt must access this imported library, and we cannot export imported
libraries.
Pick-to: 6.2
Fixes: QTBUG-93671
Change-Id: Ib3c5e80cbcc9c793d000e5ad637325bcf735a1ec
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>