Add method to encapsulate dependencies to external libraries

Adding an entry that represents an external library to the
QT_USE[_PRIVATE] variable will cause qmake to lookup the
required compiler/linker flags from the configuration system,
and add them to the module that is being compiled.

Change-Id: I309aa2749ddf4fab13ab8fdd26e8ab2123719ea8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This commit is contained in:
Lars Knoll 2016-08-12 19:04:42 +02:00
parent 36ca32dbb9
commit 15bf5ef8b8

View File

@ -116,6 +116,29 @@ c++11|c++14|c++1z {
unset(cxxstd)
}
suffix =
for(ever) {
QMAKE_USE$${suffix} = $$unique(QMAKE_USE$${suffix})
for(name, QMAKE_USE$${suffix}) {
nu = $$upper($$name)
CONFIG(debug, debug|release): \
libs = $$eval(QMAKE_LIBS_$${nu}_DEBUG)
else: \
libs = $$eval(QMAKE_LIBS_$${nu}_RELEASE)
libs += $$eval(QMAKE_LIBS_$$nu)
cflags = $$eval(QMAKE_CFLAGS_$${nu})
isEmpty(libs):isEmpty(cflags): \
error("Library '$$name' is not defined.")
LIBS$${suffix} += $$libs
QMAKE_CFLAGS += $$cflags
QMAKE_CXXFLAGS += $$cflags
}
!isEmpty(suffix): break()
suffix = "_PRIVATE"
}
!precompile_header: SOURCES += $$NO_PCH_SOURCES
QMAKE_INCDIR += $$QMAKE_INCDIR_POST