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 <>
Reviewed-by: default avatarYuchen Deng <>
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))
if (ct.title.endsWith(QLatin1String("/fast")))
......@@ -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())
if (ct.title.endsWith(QLatin1String("/fast")))
if (ct.title == title)
......@@ -1103,7 +1101,6 @@ void CMakeCbpParser::parseBuildTarget()
while (!atEnd()) {
if (isEndElement()) {
if (m_buildTargetType || m_buildTarget.title == QLatin1String("all") || m_buildTarget.title == QLatin1String("install"))
} else if (name() == QLatin1String("Compiler")) {
......@@ -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