don't pass qmake configure arguments to sub-projects

the arguments after '--' are by definition meant only for the top-level
project, as that's where configure is invoked from. passing them to
sub-projects just adds noise to the make output and misleads users.

note that this specifically does not support qmake -r, which will break
if the subprojects rely on the arguments being absent. this isn't a
problem, because the qt build doesn't support qmake -r anyway.

Change-Id: I7ecff6212ce3137526005fc324a4a7ae45e3345e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Oswald Buddenhagen 2017-01-03 19:10:14 +01:00
parent 52d64fca66
commit 34cc41d8a1
6 changed files with 15 additions and 9 deletions

View File

@ -2254,12 +2254,17 @@ MakefileGenerator::writeDefaultVariables(QTextStream &t)
t << "MOVE = " << var("QMAKE_MOVE") << endl;
}
QString MakefileGenerator::buildArgs()
QString MakefileGenerator::buildArgs(bool withExtra)
{
QString ret;
for (const QString &arg : qAsConst(Option::globals->qmake_args))
ret += " " + shellQuote(arg);
if (withExtra && !Option::globals->qmake_extra_args.isEmpty()) {
ret += " --";
for (const QString &arg : qAsConst(Option::globals->qmake_extra_args))
ret += " " + shellQuote(arg);
}
return ret;
}
@ -2278,7 +2283,7 @@ QString MakefileGenerator::build_args()
ret += " " + escapeFilePath(fileFixify(project->projectFile()));
// general options and arguments
ret += buildArgs();
ret += buildArgs(true);
return ret;
}
@ -2442,7 +2447,7 @@ MakefileGenerator::writeSubTargetCall(QTextStream &t,
if (!in_directory.isEmpty())
t << "\n\t" << mkdir_p_asstring(out_directory);
pfx = "( " + chkexists.arg(out) +
+ " $(QMAKE) -o " + out + ' ' + in + buildArgs()
+ " $(QMAKE) -o " + out + ' ' + in + buildArgs(false)
+ " ) && ";
}
writeSubMakeCall(t, out_directory_cdin + pfx, makefilein);
@ -2513,7 +2518,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
t << mkdir_p_asstring(out_directory)
<< out_directory_cdin;
}
t << "$(QMAKE) -o " << out << ' ' << in << buildArgs();
t << "$(QMAKE) -o " << out << ' ' << in << buildArgs(false);
if (!dont_recurse)
writeSubMakeCall(t, out_directory_cdin, makefilein + " qmake_all");
else
@ -2710,7 +2715,7 @@ MakefileGenerator::writeMakeQmake(QTextStream &t, bool noDummyQmakeAll)
if(project->isEmpty("QMAKE_FAILED_REQUIREMENTS") && !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) {
QStringList files = escapeFilePaths(fileFixify(Option::mkfile::project_files));
t << escapeDependencyPath(project->first("QMAKE_INTERNAL_PRL_FILE").toQString()) << ": \n\t"
<< "@$(QMAKE) -prl " << files.join(' ') << ' ' << buildArgs() << endl;
<< "@$(QMAKE) -prl " << files.join(' ') << ' ' << buildArgs(true) << endl;
}
QString qmake = build_args();

View File

@ -178,7 +178,7 @@ protected:
QString specdir();
//subclasses can use these to query information about how the generator was "run"
QString buildArgs();
QString buildArgs(bool withExtra);
virtual QStringList &findDependencies(const QString &file);
virtual bool doDepends() const { return Option::mkfile::do_deps; }

View File

@ -731,7 +731,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
}
if(!meta_files.isEmpty())
t << escapeDependencyPaths(meta_files).join(" ") << ": \n\t"
<< "@$(QMAKE) -prl " << escapeFilePath(project->projectFile()) << ' ' << buildArgs() << endl;
<< "@$(QMAKE) -prl " << escapeFilePath(project->projectFile()) << ' ' << buildArgs(true) << endl;
}
if (!project->isEmpty("QMAKE_BUNDLE")) {

View File

@ -138,7 +138,7 @@ QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments(
if (arg.startsWith(QLatin1Char('-'))) {
if (arg == QLatin1String("--")) {
state.extraargs = args.mid(*pos + 1);
*pos = args.size();
args.erase(args.begin() + *pos, args.end());
return ArgumentsOk;
}
if (arg == QLatin1String("-after"))

View File

@ -105,7 +105,7 @@ public:
QProcessEnvironment environment;
#endif
QString qmake_abslocation;
QStringList qmake_args;
QStringList qmake_args, qmake_extra_args;
QString qtconf;
QString qmakespec, xqmakespec;

View File

@ -427,6 +427,7 @@ Option::init(int argc, char **argv)
//return ret == QMAKE_CMDLINE_SHOW_USAGE ? usage(argv[0]) : false;
}
globals->qmake_args = args;
globals->qmake_extra_args = cmdstate.extraargs;
}
globals->commitCommandLineArguments(cmdstate);
globals->debugLevel = Option::debug_level;