generalize environment additions to tool invocation
foo.name = VAR foo.value = baz bar foo.CONFIG = prepend QT_TOOL_ENV += foo will add the respective environment assignment to the generated command line. if value is a list, the elements are joined with the shell's path list separator. the value must be in the final form (correct path separators and shell-escaped). if .CONFIG prepend is set, the generated command will prepend the new value to a pre-existing one. Change-Id: I62c6dfb3ec50ce73d3a85a2099275f92b57a52dc Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
This commit is contained in:
parent
731e6bece5
commit
3bd2c690f4
@ -45,27 +45,39 @@ INSTALLS += target
|
||||
deppath += $$shell_path($$rpath)
|
||||
plugin_paths += $$eval(QT.$${dep}.plugin_path) $$eval(QT.$${dep}.plugins)
|
||||
}
|
||||
deppath = $$unique(deppath)
|
||||
equals(QMAKE_HOST.os, Windows): \
|
||||
deppath.name = PATH
|
||||
else:contains(QMAKE_HOST.os, Linux|FreeBSD): \
|
||||
deppath.name = LD_LIBRARY_PATH
|
||||
else:equals(QMAKE_HOST.os, Darwin): \
|
||||
deppath.name = DYLD_LIBRARY_PATH
|
||||
else: \
|
||||
error("Operating system not supported.")
|
||||
deppath.value = $$unique(deppath)
|
||||
deppath.CONFIG = prepend
|
||||
pluginpath.name = QT_PLUGIN_PATH
|
||||
pluginpath.value =
|
||||
plugin_paths = $$unique(plugin_paths)
|
||||
pluginpath =
|
||||
for(ppath, plugin_paths): \
|
||||
exists($$ppath): \
|
||||
pluginpath += $$shell_path($$ppath)
|
||||
equals(QMAKE_DIR_SEP, /) {
|
||||
equals(QMAKE_HOST.os, Windows): \
|
||||
var = PATH
|
||||
else:contains(QMAKE_HOST.os, Linux|FreeBSD): \
|
||||
var = LD_LIBRARY_PATH
|
||||
else:equals(QMAKE_HOST.os, Darwin): \
|
||||
var = DYLD_LIBRARY_PATH
|
||||
else: \
|
||||
error("Operating system not supported.")
|
||||
!isEmpty(pluginpath): pluginpath = "QT_PLUGIN_PATH=$$join(pluginpath, :) "
|
||||
cmd = "$$var=$$join(deppath, :)${$$var:+:\$$$var} $$pluginpath$$cmd"
|
||||
} else {
|
||||
!isEmpty(pluginpath): pluginpath = "(set QT_PLUGIN_PATH=$$join(pluginpath, ;)) & "
|
||||
# Escape closing parens when expanding %PATH%, otherwise cmd confuses itself.
|
||||
cmd = "(set PATH=$$join(deppath, ;);%PATH:)=^)%) & $$pluginpath$$cmd"
|
||||
pluginpath.value += $$shell_path($$ppath)
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user