make QMAKE_USE parameterizable

it's now possible to declare references which don't cause linking (or
cause only linking).

make use of this in the xcb-static library.

Change-Id: Ic429e0a1200b3a333738ea8d8e576ff64b6cac21
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This commit is contained in:
Oswald Buddenhagen 2016-09-29 17:57:53 +02:00
parent 1e97037ed9
commit cd8b7fb865
2 changed files with 10 additions and 6 deletions

View File

@ -1,7 +1,9 @@
suffix =
for(ever) {
QMAKE_USE$${suffix} = $$unique(QMAKE_USE$${suffix})
for (name, QMAKE_USE$${suffix}) {
for (use, QMAKE_USE$${suffix}) {
use = $$split(use, /)
name = $$take_first(use)
nu = $$upper($$name)
debug: \
libs = $$eval(QMAKE_LIBS_$${nu}_DEBUG)
@ -13,9 +15,12 @@ for(ever) {
isEmpty(libs):isEmpty(cflags): \
error("Library '$$name' is not defined.")
LIBS$${suffix} += $$libs
QMAKE_CFLAGS += $$cflags
QMAKE_CXXFLAGS += $$cflags
!contains(use, nolink): \
LIBS$${suffix} += $$libs
!contains(use, linkonly) {
QMAKE_CFLAGS += $$cflags
QMAKE_CXXFLAGS += $$cflags
}
}
!isEmpty(suffix): break()
suffix = "_PRIVATE"

View File

@ -11,8 +11,7 @@ XCB_DIR = ../../../../3rdparty/xcb
INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/include/xcb $$XCB_DIR/sysinclude
QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XCB
QMAKE_CFLAGS += $$QMAKE_CFLAGS_XCB
QMAKE_USE += xcb/nolink
# ignore compiler warnings in 3rdparty code
QMAKE_CFLAGS_STATIC_LIB+=-w