diff options
author | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2016-05-12 17:50:17 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2016-10-10 09:56:13 +0000 |
commit | 136f00bf938a6ac2f6b5755b2c5a6502c6c839da (patch) | |
tree | 15b5247e668c55f78289d81fb622f6cff946c1c8 | |
parent | 396c7e530d5aea6cce03600e392ca42235744c06 (diff) |
introduce a new way to pass arbitrary arguments to the project file
this is done by recognizing the -- option and putting everything that
follows it into the QMAKE_EXTRA_ARGS variable.
the purpose of this is being able to pass "alien" arguments (for example
configure options) without having to marshal them into a qmake variable
assignment manually. this is expected to greatly enhance the convenience
when no wrapper script (i.e., configure itself) is used (which will be
the case outside qtbase).
Change-Id: I47735bdab2811d17d7d394fbf638ebd14332ea73
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
(cherry picked from qtbase/26d44fce3dfb9dbd3b5be2a031fff8c1bb903960)
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
-rw-r--r-- | src/linguist/shared/qmakeglobals.cpp | 11 | ||||
-rw-r--r-- | src/linguist/shared/qmakeglobals.h | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/linguist/shared/qmakeglobals.cpp b/src/linguist/shared/qmakeglobals.cpp index 4d1bdcbd2..0b2a1ffce 100644 --- a/src/linguist/shared/qmakeglobals.cpp +++ b/src/linguist/shared/qmakeglobals.cpp @@ -136,6 +136,11 @@ QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments( break; default: if (arg.startsWith(QLatin1Char('-'))) { + if (arg == QLatin1String("--")) { + state.extraargs = args.mid(*pos + 1); + *pos = args.size(); + return ArgumentsOk; + } if (arg == QLatin1String("-after")) state.after = true; else if (arg == QLatin1String("-config")) @@ -181,6 +186,12 @@ void QMakeGlobals::commitCommandLineArguments(QMakeCmdLineParserState &state) { if (!state.preconfigs.isEmpty()) state.precmds << (fL1S("CONFIG += ") + state.preconfigs.join(QLatin1Char(' '))); + if (!state.extraargs.isEmpty()) { + QString extra = fL1S("QMAKE_EXTRA_ARGS ="); + for (const QString &ea : qAsConst(state.extraargs)) + extra += QLatin1Char(' ') + QMakeEvaluator::quoteValue(ProString(ea)); + state.precmds << extra; + } precmds = state.precmds.join(QLatin1Char('\n')); if (!state.postconfigs.isEmpty()) state.postcmds << (fL1S("CONFIG += ") + state.postconfigs.join(QLatin1Char(' '))); diff --git a/src/linguist/shared/qmakeglobals.h b/src/linguist/shared/qmakeglobals.h index 211013754..756f69dd9 100644 --- a/src/linguist/shared/qmakeglobals.h +++ b/src/linguist/shared/qmakeglobals.h @@ -85,7 +85,7 @@ class QMAKE_EXPORT QMakeCmdLineParserState public: QMakeCmdLineParserState(const QString &_pwd) : pwd(_pwd), after(false) {} QString pwd; - QStringList precmds, preconfigs, postcmds, postconfigs; + QStringList precmds, preconfigs, postcmds, postconfigs, extraargs; bool after; void flush() { after = false; } |