Set QMAKE_*_VERSION_OVERRIDE for all modules.
authorRohan McGovern <rohan.mcgovern@nokia.com>
Tue, 6 Dec 2011 07:44:59 +0000 (17:44 +1000)
committerQt by Nokia <qt-info@nokia.com>
Wed, 7 Dec 2011 11:55:28 +0000 (12:55 +0100)
On Windows, qmake searches for and uses the highest numbered available
version of each requested library, or a version with no number if no
libraries were found.  This meant that qmaking a library's consumer
before qmaking the library itself could result in the consumer
incorrectly attempting to link against $${LIB}.lib rather than the
correct $${LIB}5.lib (for example).

QMAKE_$${LIB}_VERSION_OVERRIDE is the way to work around this.

Previously, a hardcoded list of libraries had version overrides set up
on Windows, but the qmake order issue affects all libraries, not just
these.  Therefore, handle it for all modules.

Change-Id: I83b4646e3819f525193d1fc065b0d0e65b3be99f
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
mkspecs/features/qt_functions.prf
mkspecs/features/qt_module_config.prf

index 04737f5..65eec35 100644 (file)
@@ -76,6 +76,7 @@ defineTest(qtAddModule) {
     MODULE_INCLUDES = $$eval(QT.$${1}.includes)
     MODULE_LIBS = $$eval(QT.$${1}.libs)
     MODULE_CONFIG = $$eval(QT.$${1}.module_config)
+    MODULE_MAJOR_VERSION = $$eval(QT.$${1}.MAJOR_VERSION)
 
     CONFIG += $$eval(QT.$${1}.CONFIG)
     DEFINES += $$eval(QT.$${1}.DEFINES)
@@ -119,6 +120,16 @@ defineTest(qtAddModule) {
         }
     }
 
+    win32 {
+        # Make sure we link against the version pulled from the module's .pri
+        ver_var    = QMAKE_$${upper($$MODULE_NAME$$QT_LIBINFIX)}_VERSION_OVERRIDE
+        dver_var   = QMAKE_$${upper($$MODULE_NAME$$QT_LIBINFIX)}D_VERSION_OVERRIDE
+        $$ver_var  = $$MODULE_MAJOR_VERSION
+        $$dver_var = $$MODULE_MAJOR_VERSION
+        export($$ver_var)
+        export($$dver_var)
+    }
+
     isEmpty(LINKAGE) {
        # Make sure we can link to uninstalled libraries
        !isEqual(MODULE_LIBS, $$[QT_INSTALL_LIBS]) {
index 3d86127..6104362 100644 (file)
@@ -33,19 +33,6 @@ for(include_path, MODULE_INCLUDES):LAST_MODULE_INCLUDE=$${include_path}
 HEADERS_PRI = $$LAST_MODULE_INCLUDE/headers.pri
 include($$HEADERS_PRI, "", true)|clear(HEADERS_PRI)
 
-#version overriding
-win32 {
-    #because libnetwork.pro could be qmake'd (qmade?) before libqcore.pro we
-    #need to override the version of libq* in all other libq*'s just to be
-    #sure the same version is used
-        VERSIONS_LIST = $$split(VERSION, ".")
-    QT_LIBS_OVERRIDE = $$member(VERSIONS_LIST, 0)
-        for(lib, $$list(qtcore qtgui qtnetwork qtxml qtopengl qtsql qt3support)) {
-        eval(QMAKE_$${upper($$lib)}_VERSION_OVERRIDE = $$QT_LIBS_OVERRIDE)
-        eval(QMAKE_$${upper($$lib)}D_VERSION_OVERRIDE = $$QT_LIBS_OVERRIDE)
-    }
-}
-
 #other
 DESTDIR          = $$eval(QT.$${MODULE}.libs)
 win32:!wince*:DLLDESTDIR = $$[QT_INSTALL_PREFIX]/bin