diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2012-09-06 19:08:28 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-09-07 23:35:14 +0200 |
commit | 3bd2c690f4624d933e5f5679ea1ee905cbe1f398 (patch) | |
tree | 343234b24923a7a3fca8f0dd542e530001216a38 /mkspecs | |
parent | 731e6bece5cebe205ca47c1c078c7ac18984ba1c (diff) |
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>
Diffstat (limited to 'mkspecs')
-rw-r--r-- | mkspecs/features/qt_tool.prf | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/mkspecs/features/qt_tool.prf b/mkspecs/features/qt_tool.prf index ec1a4df1f5..758d52444c 100644 --- a/mkspecs/features/qt_tool.prf +++ b/mkspecs/features/qt_tool.prf @@ -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" + } } } |