summaryrefslogtreecommitdiffstats
path: root/src/entrypoint
diff options
context:
space:
mode:
Diffstat (limited to 'src/entrypoint')
-rw-r--r--src/entrypoint/CMakeLists.txt11
-rw-r--r--src/entrypoint/entrypoint.pro5
2 files changed, 14 insertions, 2 deletions
diff --git a/src/entrypoint/CMakeLists.txt b/src/entrypoint/CMakeLists.txt
index 1bc0834b64..add9023a7d 100644
--- a/src/entrypoint/CMakeLists.txt
+++ b/src/entrypoint/CMakeLists.txt
@@ -32,6 +32,8 @@ set_target_properties(EntryPoint PROPERTIES
INTERFACE_QT_MODULE_INTERNAL_CONFIG "staticlib"
)
+set(module_pri_entrypoint_ldflags "")
+
# ---- While the static library target does the work ----
qt_internal_add_cmake_library(EntryPointImplementation STATIC
@@ -65,9 +67,10 @@ if(WIN32)
if(MINGW)
# The mingw32 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. The logic is duplicated in entrypoint.prf
- # on the qmake side.
+ # from the entry-point library.
target_link_libraries(EntryPoint INTERFACE mingw32)
+ list(APPEND module_pri_entrypoint_ldflags "-lmingw32")
+
target_compile_definitions(EntryPoint INTERFACE QT_NEEDS_QMAIN)
qt_internal_extend_target(EntryPointImplementation DEFINES QT_NEEDS_QMAIN)
endif()
@@ -75,6 +78,10 @@ endif()
# ---- Finally, make sure the static library can be consumed by clients -----
+set_target_properties(EntryPoint PROPERTIES
+ INTERFACE_QT_MODULE_LDFLAGS "${module_pri_entrypoint_ldflags}"
+)
+
# Must be added last, so that any library dependencies added above will
# precede the entrypoint library at link time.
target_link_libraries(EntryPoint INTERFACE EntryPointImplementation)
diff --git a/src/entrypoint/entrypoint.pro b/src/entrypoint/entrypoint.pro
index f139923b7e..4a0b0b6e4c 100644
--- a/src/entrypoint/entrypoint.pro
+++ b/src/entrypoint/entrypoint.pro
@@ -23,6 +23,11 @@ win32 {
mingw {
DEFINES += QT_NEEDS_QMAIN
MODULE_DEFINES += QT_NEEDS_QMAIN
+
+ # 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.
+ MODULE_LDFLAGS += -lmingw32
}
}