Commit 6a17eafa authored by Tobias Hunger's avatar Tobias Hunger

CMake: Use Utils::algorithm

Change-Id: I6d15c9e68c2e9680668509022d8a771e4c7c595a
Reviewed-by: default avatarNiels Weber <niels.weber@theqtcompany.com>
parent ad6c0f9b
......@@ -404,22 +404,18 @@ QList<CMakeBuildTarget> CMakeProject::buildTargets() const
QStringList CMakeProject::buildTargetTitles(bool runnable) const
{
QStringList results;
foreach (const CMakeBuildTarget &ct, m_buildTargets) {
if (runnable && (ct.executable.isEmpty() || ct.targetType != ExecutableType))
continue;
results << ct.title;
}
return results;
const QList<CMakeBuildTarget> targets
= runnable ? Utils::filtered(m_buildTargets,
[](const CMakeBuildTarget &ct) {
return !ct.executable.isEmpty() && ct.targetType == ExecutableType;
})
: m_buildTargets;
return Utils::transform(targets, [](const CMakeBuildTarget &ct) { return ct.title; });
}
bool CMakeProject::hasBuildTarget(const QString &title) const
{
foreach (const CMakeBuildTarget &ct, m_buildTargets) {
if (ct.title == title)
return true;
}
return false;
return Utils::anyOf(m_buildTargets, [title](const CMakeBuildTarget &ct) { return ct.title == title; });
}
void CMakeProject::gatherFileNodes(ProjectExplorer::FolderNode *parent, QList<ProjectExplorer::FileNode *> &list)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment