summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmake/QtPriHelpers.cmake5
-rw-r--r--mkspecs/features/entrypoint.prf11
-rw-r--r--mkspecs/features/qt.prf4
-rw-r--r--mkspecs/features/qt_module_pris.prf1
-rw-r--r--src/entrypoint/CMakeLists.txt11
-rw-r--r--src/entrypoint/entrypoint.pro5
6 files changed, 24 insertions, 13 deletions
diff --git a/cmake/QtPriHelpers.cmake b/cmake/QtPriHelpers.cmake
index 80440e15a1..6483bd0c76 100644
--- a/cmake/QtPriHelpers.cmake
+++ b/cmake/QtPriHelpers.cmake
@@ -150,9 +150,11 @@ function(qt_generate_module_pri_file target)
"${property_prefix}QT_MODULE_USES")
get_target_property(module_pri_extra_content "${target}"
"${property_prefix}QT_MODULE_PRI_EXTRA_CONTENT")
+ get_target_property(module_ldflags "${target}"
+ "${property_prefix}QT_MODULE_LDFLAGS")
foreach(var enabled_features disabled_features enabled_private_features disabled_private_features
- module_internal_config module_uses module_pri_extra_content)
+ module_internal_config module_uses module_pri_extra_content module_ldflags)
if(${var} STREQUAL "${var}-NOTFOUND")
set(${var} "")
else()
@@ -265,6 +267,7 @@ function(qt_generate_module_pri_file target)
QT.${config_module_name}.name = ${module}
QT.${config_module_name}.module = ${module_name_in_pri}${QT_LIBINFIX}
QT.${config_module_name}.libs = $$QT_MODULE_LIB_BASE
+QT.${config_module_name}.ldflags = ${module_ldflags}
QT.${config_module_name}.includes = ${public_module_includes}
QT.${config_module_name}.frameworks = ${public_module_frameworks}
QT.${config_module_name}.bins = $$QT_MODULE_BIN_BASE${module_plugin_types_assignment}
diff --git a/mkspecs/features/entrypoint.prf b/mkspecs/features/entrypoint.prf
index 48bb378034..fbe637326e 100644
--- a/mkspecs/features/entrypoint.prf
+++ b/mkspecs/features/entrypoint.prf
@@ -1,11 +1,2 @@
-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:!console:contains(TEMPLATE, ".*app"): \
QT_PRIVATE += entrypoint_private
-}
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf
index c1691a7894..55a51293ac 100644
--- a/mkspecs/features/qt.prf
+++ b/mkspecs/features/qt.prf
@@ -180,6 +180,7 @@ for(ever) {
MODULE_NAME = $$eval(QT.$${QTLIB}.name)
MODULE_MODULE = $$eval(QT.$${QTLIB}.module)
MODULE_INCLUDES = $$eval(QT.$${QTLIB}.includes)
+ MODULE_LDFLAGS = $$eval(QT.$${QTLIB}.ldflags)
MODULE_LIBS = $$eval(QT.$${QTLIB}.libs)
MODULE_FRAMEWORKS = $$eval(QT.$${QTLIB}.frameworks)
MODULE_USES = $$eval(QT.$${QTLIB}.uses)
@@ -200,6 +201,9 @@ for(ever) {
MODULE_INCLUDES -= $$QMAKE_DEFAULT_INCDIRS
+ # Add linker flags before lib
+ LIBS$$var_sfx += $$MODULE_LDFLAGS
+
# Frameworks shouldn't need include paths, but much code does not use
# module-qualified #includes, so by default we add paths which point
# directly into the frameworks. Private modules have somewhat convoluted
diff --git a/mkspecs/features/qt_module_pris.prf b/mkspecs/features/qt_module_pris.prf
index 9b632a864f..7a6cc56754 100644
--- a/mkspecs/features/qt_module_pris.prf
+++ b/mkspecs/features/qt_module_pris.prf
@@ -135,6 +135,7 @@ defineReplace(qtExportLibsForModule) {
"" \
"QT.$${MODULE_ID}.name = $$TARGET" \
"QT.$${MODULE_ID}.module = $$module_module" \
+ "QT.$${MODULE_ID}.ldflags = $$MODULE_LDFLAGS" \
"QT.$${MODULE_ID}.libs = $$module_libs" \
$$module_master \
"QT.$${MODULE_ID}.includes = $$MODULE_INCLUDES" \
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
}
}