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