make qtAddLibrary() a noisy compat wrapper for qtAddModule()

it's used by people (in particular, qt creator), so it would be not nice
to just delete it entirely.

Change-Id: I6bd849d00ebfe3b9b126e01a6d1c6e7c6584d8ac
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
This commit is contained in:
Oswald Buddenhagen 2012-03-01 18:49:29 +01:00
parent c4eed770be
commit 84fb7be6c1

View File

@ -22,53 +22,17 @@ defineReplace(qtLibraryTarget) {
} }
defineTest(qtAddLibrary) { defineTest(qtAddLibrary) {
INCLUDEPATH -= $$QMAKE_INCDIR_QT/$$1 warning("qtAddLibrary() is deprecated. Use qtAddModule() or QT+= instead.")
INCLUDEPATH = $$QMAKE_INCDIR_QT/$$1 $$INCLUDEPATH
LIB_NAME = $$1 # Reverse-engineer the module name from the library name.
unset(LINKAGE) for(var, $$list($$find($$list($$enumerate_vars()), ^QT\\.[^.]+\\.name$))) {
mac { isEqual($$var, $$1) {
CONFIG(qt_framework, qt_framework|qt_no_framework) { #forced var ~= s,^QT\\.([^.]+)\\.name$,\\1,
QMAKE_FRAMEWORKPATH *= $${QMAKE_LIBDIR_QT} qtAddModule($$var):return(true):break()
FRAMEWORK_INCLUDE = $$QMAKE_LIBDIR_QT/$${LIB_NAME}.framework/Headers return(false):break() # Yes, the break is insanity. But necessary.
!qt_no_framework_direct_includes:exists($$FRAMEWORK_INCLUDE) {
INCLUDEPATH -= $$FRAMEWORK_INCLUDE
INCLUDEPATH = $$FRAMEWORK_INCLUDE $$INCLUDEPATH
}
LINKAGE = -framework $${LIB_NAME}$${QT_LIBINFIX}
} else:!qt_no_framework { #detection
for(frmwrk_dir, $$list($$QMAKE_LIBDIR_QT $$QMAKE_LIBDIR $$(DYLD_FRAMEWORK_PATH) /Library/Frameworks)) {
exists($${frmwrk_dir}/$${LIB_NAME}.framework) {
QMAKE_FRAMEWORKPATH *= $${frmwrk_dir}
FRAMEWORK_INCLUDE = $$frmwrk_dir/$${LIB_NAME}.framework/Headers
!qt_no_framework_direct_includes:exists($$FRAMEWORK_INCLUDE) {
INCLUDEPATH -= $$FRAMEWORK_INCLUDE
INCLUDEPATH = $$FRAMEWORK_INCLUDE $$INCLUDEPATH
}
LINKAGE = -framework $${LIB_NAME}
break()
} }
} }
} error("No module matching library '$$1' found.")
}
isEmpty(LINKAGE) {
if(!debug_and_release|build_pass):CONFIG(debug, debug|release) {
win32:LINKAGE = -l$${LIB_NAME}$${QT_LIBINFIX}d
mac:LINKAGE = -l$${LIB_NAME}$${QT_LIBINFIX}_debug
}
isEmpty(LINKAGE):LINKAGE = -l$${LIB_NAME}$${QT_LIBINFIX}
}
!isEmpty(QMAKE_LSB) {
QMAKE_LFLAGS *= --lsb-libpath=$$$$QMAKE_LIBDIR_QT
QMAKE_LFLAGS *= -L/opt/lsb/lib
QMAKE_LFLAGS *= --lsb-shared-libs=$${LIB_NAME}$${QT_LIBINFIX}
}
LIBS += $$LINKAGE
export(LIBS)
export(INCLUDEPATH)
export(QMAKE_FRAMEWORKPATH)
export(QMAKE_LFLAGS)
return(true)
} }
defineTest(qtAddModule) { defineTest(qtAddModule) {