Fix qmake builds of Windows applications against a CMake-built Qt

QMake's windows.prf expects the WinMain library to be named
'qtmain[d].lib' and not 'Qt6WinMain[d].lib'. We're renaming the
library to 'qtmain[d].lib' in the CMake build now to avoid adjusting
the qmake build of Qt.

Also, we have to add the private library shell32.lib to WinMain to
make it appear in qtmain.prl and having it linked to Windows GUI
applications.

Fixes: QTBUG-84425
Change-Id: Ia94090b89e037b17ebfded359b293c8586371d59
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Joerg Bornemann 2020-05-26 08:34:11 +02:00
parent ce2bc0e2d5
commit e7d12b876a

View File

@ -14,12 +14,15 @@ qt_add_module(WinMain
$<TARGET_PROPERTY:Qt::Core,INTERFACE_INCLUDE_DIRECTORIES>
)
set_property(TARGET WinMain PROPERTY OUTPUT_NAME qtmain)
qt_extend_target(WinMain CONDITION WINRT
SOURCES qtmain_winrt.cpp
)
qt_extend_target(WinMain CONDITION NOT WINRT
SOURCES qtmain_win.cpp
LIBRARIES shell32
)
qt_extend_target(WinMain CONDITION MINGW