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>
This commit is contained in:
parent
fade295814
commit
26d44fce3d
@ -134,6 +134,11 @@ QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments(
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (arg.startsWith(QLatin1Char('-'))) {
|
if (arg.startsWith(QLatin1Char('-'))) {
|
||||||
|
if (arg == QLatin1String("--")) {
|
||||||
|
state.extraargs = args.mid(*pos + 1);
|
||||||
|
*pos = args.size();
|
||||||
|
return ArgumentsOk;
|
||||||
|
}
|
||||||
if (arg == QLatin1String("-after"))
|
if (arg == QLatin1String("-after"))
|
||||||
state.after = true;
|
state.after = true;
|
||||||
else if (arg == QLatin1String("-config"))
|
else if (arg == QLatin1String("-config"))
|
||||||
@ -179,6 +184,12 @@ void QMakeGlobals::commitCommandLineArguments(QMakeCmdLineParserState &state)
|
|||||||
{
|
{
|
||||||
if (!state.preconfigs.isEmpty())
|
if (!state.preconfigs.isEmpty())
|
||||||
state.precmds << (fL1S("CONFIG += ") + state.preconfigs.join(QLatin1Char(' ')));
|
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'));
|
precmds = state.precmds.join(QLatin1Char('\n'));
|
||||||
if (!state.postconfigs.isEmpty())
|
if (!state.postconfigs.isEmpty())
|
||||||
state.postcmds << (fL1S("CONFIG += ") + state.postconfigs.join(QLatin1Char(' ')));
|
state.postcmds << (fL1S("CONFIG += ") + state.postconfigs.join(QLatin1Char(' ')));
|
||||||
|
@ -85,7 +85,7 @@ class QMAKE_EXPORT QMakeCmdLineParserState
|
|||||||
public:
|
public:
|
||||||
QMakeCmdLineParserState(const QString &_pwd) : pwd(_pwd), after(false) {}
|
QMakeCmdLineParserState(const QString &_pwd) : pwd(_pwd), after(false) {}
|
||||||
QString pwd;
|
QString pwd;
|
||||||
QStringList precmds, preconfigs, postcmds, postconfigs;
|
QStringList precmds, preconfigs, postcmds, postconfigs, extraargs;
|
||||||
bool after;
|
bool after;
|
||||||
|
|
||||||
void flush() { after = false; }
|
void flush() { after = false; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user