From 864e1ceaf628e823103ae2d28d2c983400ba38c7 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 30 Jan 2013 18:37:11 +0100 Subject: [PATCH] don't flush qmake command line twice otherwise variable assignments (including -config options) from $QMAKEFLAGS are lost. Change-Id: I818e9372d2b0ff44333dc3eb8fc3420f84ab01c5 Reviewed-by: Joerg Bornemann Reviewed-by: Oswald Buddenhagen --- qmake/library/qmakeglobals.h | 2 ++ qmake/option.cpp | 13 +++++++------ qmake/option.h | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/qmake/library/qmakeglobals.h b/qmake/library/qmakeglobals.h index 9f8893ec9c..efb4d28a63 100644 --- a/qmake/library/qmakeglobals.h +++ b/qmake/library/qmakeglobals.h @@ -99,6 +99,8 @@ public: QString pwd; QStringList precmds, preconfigs, postcmds, postconfigs; bool after; + + void flush() { after = false; } }; class QMAKE_EXPORT QMakeGlobals diff --git a/qmake/option.cpp b/qmake/option.cpp index 7d16949242..fdf11d9266 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -193,9 +193,8 @@ bool usage(const char *a0) } int -Option::parseCommandLine(QStringList &args) +Option::parseCommandLine(QStringList &args, QMakeCmdLineParserState &state) { - QMakeCmdLineParserState state(QDir::currentPath()); enum { ArgNone, ArgOutput } argState = ArgNone; int x = 0; while (x < args.count()) { @@ -313,8 +312,6 @@ Option::parseCommandLine(QStringList &args) fprintf(stderr, "***Option %s requires a parameter\n", qPrintable(args.at(x - 1))); return Option::QMAKE_CMDLINE_SHOW_USAGE | Option::QMAKE_CMDLINE_ERROR; } - globals->commitCommandLineArguments(state); - globals->debugLevel = Option::debug_level; return Option::QMAKE_CMDLINE_SUCCESS; } @@ -374,6 +371,7 @@ Option::init(int argc, char **argv) Option::qmake_mode = Option::QMAKE_GENERATE_MAKEFILE; } + QMakeCmdLineParserState cmdstate(QDir::currentPath()); const QByteArray envflags = qgetenv("QMAKEFLAGS"); if (!envflags.isNull()) { QStringList args; @@ -399,7 +397,8 @@ Option::init(int argc, char **argv) } if (hasWord) args << QString::fromLocal8Bit(buf); - parseCommandLine(args); + parseCommandLine(args, cmdstate); + cmdstate.flush(); } if(argc && argv) { QStringList args; @@ -430,7 +429,7 @@ Option::init(int argc, char **argv) break; } - int ret = parseCommandLine(args); + int ret = parseCommandLine(args, cmdstate); if(ret != Option::QMAKE_CMDLINE_SUCCESS) { if ((ret & Option::QMAKE_CMDLINE_SHOW_USAGE) != 0) usage(argv[0]); @@ -439,6 +438,8 @@ Option::init(int argc, char **argv) } Option::qmake_args = args; } + globals->commitCommandLineArguments(cmdstate); + globals->debugLevel = Option::debug_level; //last chance for defaults if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || diff --git a/qmake/option.h b/qmake/option.h index 7ca0d274ff..541757b264 100644 --- a/qmake/option.h +++ b/qmake/option.h @@ -207,7 +207,7 @@ struct Option }; private: - static int parseCommandLine(QStringList &args); + static int parseCommandLine(QStringList &args, QMakeCmdLineParserState &state); }; inline QString fixEnvVariables(const QString &x) { return Option::fixString(x, Option::FixEnvVars); }