diff --git a/src/plugins/qt4projectmanager/qmakestep.cpp b/src/plugins/qt4projectmanager/qmakestep.cpp index ed9d8a75d56..45699c6d2ee 100644 --- a/src/plugins/qt4projectmanager/qmakestep.cpp +++ b/src/plugins/qt4projectmanager/qmakestep.cpp @@ -91,45 +91,6 @@ QStringList QMakeStep::arguments(const QString &buildConfiguration) return arguments; } -// We match -spec and -platfrom separetly -// We ignore -cache, because qmake contained a bug that it didn't -// mention the -cache in the Makefile -// That means changing the -cache option in the additional arguments -// does not automatically rerun qmake. Alas, we could try more -// intelligent matching for -cache, but i guess people rarely -// do use that. - -QStringList removeSpecFromArgumentList(const QStringList &old) -{ - if (!old.contains("-spec") && !old.contains("-platform")) - return old; - QStringList newList; - bool ignoreNext = false; - foreach(const QString &item, old) { - if (ignoreNext) { - ignoreNext = false; - } else if (item == "-spec" || item == "-platform" || item == "-cache") { - ignoreNext = true; - } else { - newList << item; - } - } - return newList; -} - -QString extractSpecFromArgumentList(const QStringList &list) -{ - int index = list.indexOf("-spec"); - if (index == -1) - index = list.indexOf("-platform"); - if (index == -1) - return QString(); - if (index + 1 < list.length()) - return list.at(index +1); - else - return QString(); -} - bool QMakeStep::init(const QString &name) { m_buildConfiguration = name; @@ -155,50 +116,7 @@ bool QMakeStep::init(const QString &name) if (QDir(workingDirectory).exists(QLatin1String("Makefile"))) { QString qtPath = QtVersionManager::findQtVersionFromMakefile(workingDirectory); if (qtVersion->path() == qtPath) { - // same qtversion - QPair result = - QtVersionManager::scanMakeFile(workingDirectory, qtVersion->defaultBuildConfig()); - if (QtVersion::QmakeBuildConfig(m_pro->value(name, "buildConfiguration").toInt()) == result.first) { - // The QMake Build Configuration are the same, - // now compare arguments lists - // we have to compare without the spec/platform cmd argument - // and compare that on its own - QString actualSpec = extractSpecFromArgumentList(value(name, "qmakeArgs").toStringList()); - if (actualSpec.isEmpty()) - actualSpec = m_pro->qtVersion(name)->mkspec(); - QString parsedSpec = extractSpecFromArgumentList(result.second); - - // Now to convert the actualSpec to a absolute path, we go through a few hops - if (QFileInfo(actualSpec).isRelative()) { - QString path = qtVersion->sourcePath() + "/mkspecs/" + actualSpec; - if (QFileInfo(path).exists()) { - actualSpec = QDir::cleanPath(path); - } else { - path = qtVersion->versionInfo().value("QMAKE_MKSPECS") + "/" + actualSpec; - if (QFileInfo(path).exists()) { - actualSpec = QDir::cleanPath(path); - } else { - path = workingDirectory + "/" + actualSpec; - if (QFileInfo(path).exists()) - actualSpec = QDir::cleanPath(path); - } - } - } - - if (QFileInfo(parsedSpec).isRelative()) - parsedSpec = QDir::cleanPath(workingDirectory + "/" + parsedSpec); - - QStringList actualArgs = removeSpecFromArgumentList(value(name, "qmakeArgs").toStringList()); - QStringList parsedArgs = removeSpecFromArgumentList(result.second); - - qDebug()<<"Actual args:"<compareBuildConfigurationToImportFrom(name, workingDirectory); } } diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp index cd8be85a9ef..c242402ff04 100644 --- a/src/plugins/qt4projectmanager/qt4project.cpp +++ b/src/plugins/qt4projectmanager/qt4project.cpp @@ -1098,6 +1098,107 @@ void Qt4Project::invalidateCachedTargetInformation() emit targetInformationChanged(); } +// We match -spec and -platfrom separetly +// We ignore -cache, because qmake contained a bug that it didn't +// mention the -cache in the Makefile +// That means changing the -cache option in the additional arguments +// does not automatically rerun qmake. Alas, we could try more +// intelligent matching for -cache, but i guess people rarely +// do use that. + +QStringList removeSpecFromArgumentList(const QStringList &old) +{ + if (!old.contains("-spec") && !old.contains("-platform") && !old.contains("-cache")) + return old; + QStringList newList; + bool ignoreNext = false; + foreach(const QString &item, old) { + qDebug()<<"Item:"<path() == qtPath) { + // same qtversion + QPair result = + QtVersionManager::scanMakeFile(workingDirectory, version->defaultBuildConfig()); + if (QtVersion::QmakeBuildConfig(value(buildConfiguration, "buildConfiguration").toInt()) == result.first) { + // The QMake Build Configuration are the same, + // now compare arguments lists + // we have to compare without the spec/platform cmd argument + // and compare that on its own + QString actualSpec = extractSpecFromArgumentList(qmakeStep()->value(buildConfiguration, "qmakeArgs").toStringList()); + if (actualSpec.isEmpty()) + actualSpec = qtVersion(buildConfiguration)->mkspec(); + QString parsedSpec = extractSpecFromArgumentList(result.second); + + // Now to convert the actualSpec to a absolute path, we go through a few hops + if (QFileInfo(actualSpec).isRelative()) { + QString path = version->sourcePath() + "/mkspecs/" + actualSpec; + if (QFileInfo(path).exists()) { + actualSpec = QDir::cleanPath(path); + } else { + path = version->versionInfo().value("QMAKE_MKSPECS") + "/" + actualSpec; + if (QFileInfo(path).exists()) { + actualSpec = QDir::cleanPath(path); + } else { + path = workingDirectory + "/" + actualSpec; + if (QFileInfo(path).exists()) + actualSpec = QDir::cleanPath(path); + } + } + } + + if (QFileInfo(parsedSpec).isRelative()) + parsedSpec = QDir::cleanPath(workingDirectory + "/" + parsedSpec); + + + qDebug()<<"before:"<value(buildConfiguration, "qmakeArgs").toStringList(); + QStringList actualArgs = removeSpecFromArgumentList(qmakeStep()->value(buildConfiguration, "qmakeArgs").toStringList()); + qDebug()<<"after:"<