Partially decouple local CMakeRunConfiguration from CMakeProject

Funnel all relevant data through target.applicationTargets() as
done for the non-local CMake-supporting setups and QBS already.

There is cleanup potential left for later changes.

Change-Id: I49ed6abd98c058a7fd1545e41b3bcd6ecb758a8b
Task-number: QTCREATORBUG-19985
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
hjk
2018-03-12 16:33:28 +01:00
parent 3f86d55587
commit a5d6fe33cb
9 changed files with 43 additions and 87 deletions

View File

@@ -473,20 +473,9 @@ void CMakeProject::startParsing(int reparseParameters)
m_buildDirManager.parse(reparseParameters);
}
QStringList CMakeProject::buildTargetTitles(bool runnable) const
QStringList CMakeProject::buildTargetTitles() const
{
const QList<CMakeBuildTarget> targets
= runnable ? filtered(buildTargets(),
[](const CMakeBuildTarget &ct) {
return !ct.executable.isEmpty() && ct.targetType == ExecutableType;
})
: buildTargets();
return transform(targets, [](const CMakeBuildTarget &ct) { return ct.title; });
}
bool CMakeProject::hasBuildTarget(const QString &title) const
{
return anyOf(buildTargets(), [title](const CMakeBuildTarget &ct) { return ct.title == title; });
return transform(buildTargets(), [](const CMakeBuildTarget &ct) { return ct.title; });
}
Project::RestoreResult CMakeProject::fromMap(const QVariantMap &map, QString *errorMessage)
@@ -562,14 +551,6 @@ void CMakeProject::combineScanAndParse(CMakeBuildConfiguration *bc)
emitParsingFinished(m_combinedScanAndParseResult);
}
CMakeBuildTarget CMakeProject::buildTargetForTitle(const QString &title)
{
foreach (const CMakeBuildTarget &ct, buildTargets())
if (ct.title == title)
return ct;
return CMakeBuildTarget();
}
QStringList CMakeProject::filesGeneratedFrom(const QString &sourceFile) const
{
if (!activeTarget())
@@ -676,10 +657,15 @@ void CMakeProject::updateApplicationAndDeploymentTargets()
}
}
if (ct.targetType == ExecutableType) {
FileName srcWithTrailingSlash = FileName::fromString(ct.sourceDirectory.toString());
srcWithTrailingSlash.appendString('/');
// TODO: Put a path to corresponding .cbp file into projectFilePath?
appTargetList.list << BuildTargetInfo(ct.title, ct.executable, srcWithTrailingSlash);
BuildTargetInfo bti;
bti.targetName = ct.title;
bti.displayName = ct.title;
bti.targetFilePath = ct.executable;
bti.projectFilePath = ct.sourceDirectory;
bti.projectFilePath.appendString('/');
bti.workingDirectory = ct.workingDirectory;
bti.buildKey = ct.title + QChar('\n') + bti.projectFilePath.toString();
appTargetList.list.append(bti);
}
}