don't flush qmake command line twice

otherwise variable assignments (including -config options) from
$QMAKEFLAGS are lost.

Change-Id: I818e9372d2b0ff44333dc3eb8fc3420f84ab01c5
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
Oswald Buddenhagen 2013-01-30 18:37:11 +01:00 committed by The Qt Project
parent d011f64524
commit 864e1ceaf6
3 changed files with 10 additions and 7 deletions

View File

@ -99,6 +99,8 @@ public:
QString pwd;
QStringList precmds, preconfigs, postcmds, postconfigs;
bool after;
void flush() { after = false; }
};
class QMAKE_EXPORT QMakeGlobals

View File

@ -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 ||

View File

@ -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); }