factor out qtAddToolEnv()

so it's available for other users as well

Change-Id: I2d5a14ae427575c07321ac532b13ee03308b837f
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
bb10
Oswald Buddenhagen 2012-09-13 18:13:13 +02:00 committed by Qt by Nokia
parent fb8a6297f4
commit 321687f03b
2 changed files with 21 additions and 16 deletions

View File

@ -184,6 +184,26 @@ defineTest(qtPrepareTool) {
export($$1)
}
defineTest(qtAddToolEnv) {
for(env, 2) {
value = $$eval($${env}.value)
!isEmpty(value) {
name = $$eval($${env}.name)
equals(QMAKE_DIR_SEP, /) {
contains($${env}.CONFIG, prepend): infix = \${$$name:+:\$$$name}
else: infix =
$$1 = "$$name=$$join(value, :)$$infix $$eval($$1)"
} else {
# Escape closing parens when expanding the variable, otherwise cmd confuses itself.
contains($${env}.CONFIG, prepend): infix = ;%$$name:)=^)%
else: infix =
$$1 = "(set $$name=$$join(value, ;)$$infix) & $$eval($$1)"
}
}
}
export($$1)
}
defineReplace(pkgConfigExecutable) {
isEmpty(PKG_CONFIG) {
PKG_CONFIG = pkg-config

View File

@ -64,22 +64,7 @@ INSTALLS += target
QT_TOOL_ENV += deppath pluginpath
}
for(env, QT_TOOL_ENV) {
value = $$eval($${env}.value)
!isEmpty(value) {
name = $$eval($${env}.name)
equals(QMAKE_DIR_SEP, /) {
contains($${env}.CONFIG, prepend): infix = \${$$name:+:\$$$name}
else: infix =
cmd = "$$name=$$join(value, :)$$infix $$cmd"
} else {
# Escape closing parens when expanding the variable, otherwise cmd confuses itself.
contains($${env}.CONFIG, prepend): infix = ;%$$name:)=^)%
else: infix =
cmd = "(set $$name=$$join(value, ;)$$infix) & $$cmd"
}
}
}
qtAddToolEnv(cmd, $$QT_TOOL_ENV)
TOOL_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules/qt_$${MODULE}.pri