summaryrefslogtreecommitdiffstats
path: root/src/entrypoint
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-11-02 17:12:32 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-11-03 00:14:04 +0100
commit6032a9ca1a69fa074d6d0ffe5ada642770af1d00 (patch)
tree11bbd74b354d38142549d553b08be55aadd0dbdb /src/entrypoint
parent2096463afc40acdabbaa587e18c0184f04d76dfb (diff)
Allow adding linker flags to qmake module pris
The flags go before the library in the final linker line, as opposed to the dependencies declared in LIBS. This allows us to declare the flags for the entrypoint in the project file of the entrypoint, instead of in a standalone prf. Change-Id: I35c054fe9fdaa6add7cd0e8ba3f7304f975ff80f Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
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
}
}