Set QMAKE_*_VERSION_OVERRIDE for all modules.

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>
This commit is contained in:
Rohan McGovern 2011-12-06 17:44:59 +10:00 committed by Qt by Nokia
parent bab5329437
commit 7e66f6c207
2 changed files with 11 additions and 13 deletions

View 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]) {

View 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