From 15bf5ef8b8e4299b14626690c359baa14819cd35 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 12 Aug 2016 19:04:42 +0200 Subject: 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 Reviewed-by: Oswald Buddenhagen --- mkspecs/features/default_post.prf | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'mkspecs') diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf index e7e9a5bd87..edc3cac7ba 100644 --- a/mkspecs/features/default_post.prf +++ b/mkspecs/features/default_post.prf @@ -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 -- cgit v1.2.3