qt5base-lts/mkspecs/features/qmake_use.prf
Oswald Buddenhagen 33276e1cf1 add support for transitive deps to QMAKE_USE
we already knew the dependencies (as they are declared in the json
files), but failed to export them in any way, which made linking against
statically built external deps which have deps in turn fail (unless the
project happened to pull in the dep anyway, as is the case with qtcore +
zlib).

the previous assumption was that the USE-able library objects would be
self-contained, but that is conceptually unclean. instead, properly
export the raw dependencies and resolve them only in qmake_use.prf.

note that pkg-config produces self-contained output, so we need to
actively subtract the dependencies we know.

Change-Id: I4b41a7efc05bbd309a6d66275d7557a80efd5af4
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-12-07 23:48:11 +00:00

33 lines
1.0 KiB
Plaintext

suffix =
for(ever) {
CC_USES =
LD_USES =
for (use, QMAKE_USE$${suffix}) {
use = $$split(use, /)
name = $$take_first(use)
nu = $$upper($$name)
!contains(use, linkonly): CC_USES += $$nu
!contains(use, nolink): LD_USES += $$nu
}
CC_USES = $$resolve_depends(CC_USES, QMAKE_DEPENDS_, _CC)
for (nu, CC_USES) {
!defined(QMAKE_LIBS_$$nu, var): \
error("Library '$$lower($$nu)' is not defined.")
DEFINES += $$eval(QMAKE_DEFINES_$${nu})
INCLUDEPATH += $$eval(QMAKE_INCDIR_$${nu})
}
LD_USES = $$resolve_depends(LD_USES, QMAKE_DEPENDS_, _LD)
for (nu, LD_USES) {
!defined(QMAKE_LIBS_$$nu, var): \
error("Library '$$lower($$nu)' is not defined.")
debug: \
LIBS$${suffix} += $$eval(QMAKE_LIBS_$${nu}_DEBUG) $$eval(QMAKE_LIBS_$$nu)
else: \
LIBS$${suffix} += $$eval(QMAKE_LIBS_$${nu}_RELEASE) $$eval(QMAKE_LIBS_$$nu)
}
!isEmpty(suffix): break()
suffix = "_PRIVATE"
}