summaryrefslogtreecommitdiffstats
path: root/mkspecs
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-10-20 16:42:10 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-10-20 17:12:44 +0200
commit4ad464461f285af3fb2845eb27b1a20fc0b09b08 (patch)
treedad890ccac6258cfa2febb02df40c0488b3266de /mkspecs
parent0948846b42e0009ed2c9211c6995ce228db07032 (diff)
Fix linking of non-console application on mingw
As a result of b5af1408099d the link dependency to the mingw32 static library was ordered after the entrypoint library, which resulted in the WinMain symbol not being found during linking due to how the static linker processes archives. Fixes: QTBUG-87725 Change-Id: I8e075f91f7f06dcdc618a4e0ae6d9c1d832888c0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'mkspecs')
-rw-r--r--mkspecs/features/entrypoint.prf11
1 files changed, 10 insertions, 1 deletions
diff --git a/mkspecs/features/entrypoint.prf b/mkspecs/features/entrypoint.prf
index 8442f8930b..4601455c4a 100644
--- a/mkspecs/features/entrypoint.prf
+++ b/mkspecs/features/entrypoint.prf
@@ -1,2 +1,11 @@
-qt:!console:contains(TEMPLATE, ".*app"): \
+qt:!console:contains(TEMPLATE, ".*app") {
+ # This library needs to come before the entry-point library in the
+ # linker line, so that the static linker will pick up the WinMain
+ # symbol from the entry-point library. Unfortunately qmake and the
+ # module system doesn't allow specifying linker flags or dependencies
+ # as part of the module that end up _before_ the library itself, so
+ # we have to work around it by declaring the dependency here.
+ mingw: LIBS += -lmingw32
+
QT_PRIVATE += entrypoint
+}