forked from qt-creator/qt-creator
CMakePM: Do not add files to utility targets
On multi-config systems CMake is reporting "ALL_BUILD" or "ZERO_CHECK" as targets to add files to. When issued from menu File > Add New ... the selected target is the first target namely "ALL_BUILD", which is a utility target and cannot have source files. Fixes: QTCREATORBUG-30170 Change-Id: I7617978c01f0a2554a3ec7d52ef9baaa16ed7a84 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -216,7 +216,8 @@ void CMakeBuildSystem::requestDebugging()
|
|||||||
|
|
||||||
bool CMakeBuildSystem::supportsAction(Node *context, ProjectAction action, const Node *node) const
|
bool CMakeBuildSystem::supportsAction(Node *context, ProjectAction action, const Node *node) const
|
||||||
{
|
{
|
||||||
if (dynamic_cast<CMakeTargetNode *>(context))
|
const auto cmakeTarget = dynamic_cast<CMakeTargetNode *>(context);
|
||||||
|
if (cmakeTarget && cmakeTarget->productType() != ProductType::Other)
|
||||||
return action == ProjectAction::AddNewFile || action == ProjectAction::AddExistingFile
|
return action == ProjectAction::AddNewFile || action == ProjectAction::AddExistingFile
|
||||||
|| action == ProjectAction::AddExistingDirectory || action == ProjectAction::Rename
|
|| action == ProjectAction::AddExistingDirectory || action == ProjectAction::Rename
|
||||||
|| action == ProjectAction::RemoveFile;
|
|| action == ProjectAction::RemoveFile;
|
||||||
|
Reference in New Issue
Block a user