Commit ab8878fd authored by Stanislav Ionascu's avatar Stanislav Ionascu

CMake: Display all targets in project settings

All targets should be displayed, even without
binary artifacts, otherwise it's not possible
to select a CMake custom target to build.

Change-Id: I4b7640f460a248fd2d4b56428c2c8da3b13b9103
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
Reviewed-by: default avatarYuchen Deng <loaden@gmail.com>
parent 1566582a
......@@ -410,11 +410,11 @@ QList<CMakeBuildTarget> CMakeProject::buildTargets() const
return m_buildTargets;
}
QStringList CMakeProject::buildTargetTitles() const
QStringList CMakeProject::buildTargetTitles(bool runnable) const
{
QStringList results;
foreach (const CMakeBuildTarget &ct, m_buildTargets) {
if (ct.executable.isEmpty())
if (runnable && (ct.executable.isEmpty() || ct.library))
continue;
if (ct.title.endsWith(QLatin1String("/fast")))
continue;
......@@ -426,8 +426,6 @@ QStringList CMakeProject::buildTargetTitles() const
bool CMakeProject::hasBuildTarget(const QString &title) const
{
foreach (const CMakeBuildTarget &ct, m_buildTargets) {
if (ct.executable.isEmpty())
continue;
if (ct.title.endsWith(QLatin1String("/fast")))
continue;
if (ct.title == title)
......@@ -1103,8 +1101,7 @@ void CMakeCbpParser::parseBuildTarget()
while (!atEnd()) {
readNext();
if (isEndElement()) {
if (m_buildTargetType || m_buildTarget.title == QLatin1String("all") || m_buildTarget.title == QLatin1String("install"))
m_buildTargets.append(m_buildTarget);
m_buildTargets.append(m_buildTarget);
return;
} else if (name() == QLatin1String("Compiler")) {
parseCompiler();
......
......@@ -88,7 +88,7 @@ public:
ProjectExplorer::ProjectNode *rootProjectNode() const;
QStringList files(FilesMode fileMode) const;
QStringList buildTargetTitles() const;
QStringList buildTargetTitles(bool runnable = false) const;
QList<CMakeBuildTarget> buildTargets() const;
bool hasBuildTarget(const QString &title) const;
......
......@@ -487,7 +487,7 @@ QList<Core::Id> CMakeRunConfigurationFactory::availableCreationIds(ProjectExplor
return QList<Core::Id>();
CMakeProject *project = static_cast<CMakeProject *>(parent->project());
QList<Core::Id> allIds;
foreach (const QString &buildTarget, project->buildTargetTitles())
foreach (const QString &buildTarget, project->buildTargetTitles(true))
allIds << idFromBuildTarget(buildTarget);
return allIds;
}
......
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