diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index b6cc42fcce..d8ffa1fb84 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -22,53 +22,17 @@ defineReplace(qtLibraryTarget) { } defineTest(qtAddLibrary) { - INCLUDEPATH -= $$QMAKE_INCDIR_QT/$$1 - INCLUDEPATH = $$QMAKE_INCDIR_QT/$$1 $$INCLUDEPATH + warning("qtAddLibrary() is deprecated. Use qtAddModule() or QT+= instead.") - LIB_NAME = $$1 - unset(LINKAGE) - mac { - CONFIG(qt_framework, qt_framework|qt_no_framework) { #forced - QMAKE_FRAMEWORKPATH *= $${QMAKE_LIBDIR_QT} - FRAMEWORK_INCLUDE = $$QMAKE_LIBDIR_QT/$${LIB_NAME}.framework/Headers - !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() - } - } - } + # Reverse-engineer the module name from the library name. + for(var, $$list($$find($$list($$enumerate_vars()), ^QT\\.[^.]+\\.name$))) { + isEqual($$var, $$1) { + var ~= s,^QT\\.([^.]+)\\.name$,\\1, + qtAddModule($$var):return(true):break() + return(false):break() # Yes, the break is insanity. But necessary. + } } - 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) + error("No module matching library '$$1' found.") } defineTest(qtAddModule) {