/// user arguments
QString QMakeStep::allArguments(bool shorted)
{
- QString additonalArguments = m_userArgs;
Qt4BuildConfiguration *bc = qt4BuildConfiguration();
QStringList arguments;
if (bc->subNodeBuild())
buildConfiguration()->target()->project()->file()->fileName()).fileName());
else
arguments << QDir::toNativeSeparators(buildConfiguration()->target()->project()->file()->fileName());
- arguments << "-r";
- bool haveSpec = false;
- for (Utils::QtcProcess::ArgIterator ait(&additonalArguments); ait.next(); )
- if (ait.value() == QLatin1String("-spec"))
- haveSpec = true;
-
- if (!haveSpec) {
- const QString tcSpec = bc->toolChain() ? bc->toolChain()->mkspec() : QString();
- if (tcSpec.isEmpty()) {
- if (bc->qtVersion())
- arguments << "-spec" << bc->qtVersion()->mkspec();
- } else if (!bc->qtVersion() || bc->qtVersion()->hasMkspec(tcSpec)) {
- arguments << "-spec" << tcSpec;
- } else {
- arguments << "-spec" << bc->qtVersion()->mkspec();
+ arguments << "-r";
+ bool userProvidedMkspec = false;
+ for (Utils::QtcProcess::ConstArgIterator ait(&m_userArgs); ait.next(); ) {
+ if (ait.value() == QLatin1String("-spec")) {
+ if (ait.next()) {
+ userProvidedMkspec = true;
+ break;
+ }
}
}
+ if (!userProvidedMkspec)
+ arguments << "-spec" << mkspec();
// Find out what flags we pass on to qmake
arguments << bc->configCommandLineArguments();
arguments << moreArguments();
QString args = Utils::QtcProcess::joinArgs(arguments);
- Utils::QtcProcess::addArgs(&args, additonalArguments);
+ Utils::QtcProcess::addArgs(&args, m_userArgs);
return args;
}
return m_userArgs;
}
+QString QMakeStep::mkspec()
+{
+ Qt4BuildConfiguration *bc = qt4BuildConfiguration();
+ QString additionalArguments = m_userArgs;
+ for (Utils::QtcProcess::ArgIterator ait(&additionalArguments); ait.next(); ) {
+ if (ait.value() == QLatin1String("-spec")) {
+ if (ait.next())
+ return ait.value();
+ }
+ }
+
+ const QString tcSpec = bc->toolChain() ? bc->toolChain()->mkspec() : QString();
+ if (!bc->qtVersion())
+ return tcSpec;
+ if (!tcSpec.isEmpty() && bc->qtVersion()->hasMkspec(tcSpec))
+ return tcSpec;
+ return bc->qtVersion()->mkspec();
+}
+
QVariantMap QMakeStep::toMap() const
{
QVariantMap map(AbstractProcessStep::toMap());
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/toolchain.h>
+#include <projectexplorer/toolchainmanager.h>
#include <qtsupport/qtversionfactory.h>
#include <qtsupport/baseqtversion.h>
// we have to compare without the spec/platform cmd argument
// and compare that on its own
QString workingDirectory = QFileInfo(makefile).absolutePath();
- QString userArgs = qs->userArguments();
- QStringList actualArgs;
- QString actualSpec = extractSpecFromArguments(&userArgs, workingDirectory, version, &actualArgs);
- if (actualSpec.isEmpty()) {
- // Easy one: the user has chosen not to override the settings
- actualSpec = version->mkspec();
- }
- actualArgs += qs->moreArguments();
+ QStringList actualArgs = qs->moreArguments();
+ QString actualSpec = qs->mkspec();
QString qmakeArgs = result.second;
QStringList parsedArgs;
QtSupport::QtVersionManager::scanMakeFile(mkfile, version->defaultBuildConfig());
QtSupport::BaseQtVersion::QmakeBuildConfigs qmakeBuildConfig = result.first;
- QString aa = result.second;
- QString parsedSpec = Qt4BuildConfiguration::extractSpecFromArguments(&aa, directory, version);
- QString versionSpec = version->mkspec();
- QString additionalArguments;
- if (parsedSpec.isEmpty() || parsedSpec == versionSpec || parsedSpec == "default") {
- // using the default spec, don't modify additional arguments
- } else {
- additionalArguments = "-spec " + Utils::QtcProcess::quoteArg(parsedSpec);
- }
- Utils::QtcProcess::addArgs(&additionalArguments, aa);
-
+ QString additionalArguments = result.second;
+ QString parsedSpec = Qt4BuildConfiguration::extractSpecFromArguments(&additionalArguments, directory, version);
Qt4BuildConfiguration::removeQMLInspectorFromArguments(&additionalArguments);
// So we got all the information now apply it...
setQtVersion(version);
- qmakeStep()->setUserArguments(additionalArguments);
+ QMakeStep *qs = qmakeStep();
+ qs->setUserArguments(additionalArguments);
+ if (!parsedSpec.isEmpty() && parsedSpec != QLatin1String("default") && qs->mkspec() != parsedSpec) {
+ Utils::QtcProcess::addArgs(&additionalArguments, (QStringList() << "-spec" << parsedSpec));
+ qs->setUserArguments(additionalArguments);
+ }
setQMakeBuildConfiguration(qmakeBuildConfig);
// Adjust command line arguments, this is ugly as hell