CMake: Do not remove "Current executable" target

The "Current executable" target is an artificial target added by Qt
Creator, so we must not remove it because it is not one of the targets
from the project.

Amends dbb5a70f93

Fixes: QTCREATORBUG-24145
Change-Id: I4601bcbc7238c6bf54bc9aa3ef6eb934b65df96e
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Eike Ziller
2021-04-27 14:27:53 +02:00
parent f4ccb56976
commit b3bd8b81c4

View File

@@ -539,7 +539,9 @@ void CMakeBuildStep::recreateBuildTargetsModel()
// Remove the targets that do not exist in the build system
// This can result when selected targets get renamed
if (!targetList.empty()) {
Utils::erase(m_buildTargets, [targetList](const QString &bt) { return !targetList.contains(bt); });
Utils::erase(m_buildTargets, [targetList](const QString &bt) {
return !bt.isEmpty() /* "current executable" */ && !targetList.contains(bt);
});
if (m_buildTargets.empty())
m_buildTargets.push_back(m_allTarget);
}