forked from qt-creator/qt-creator
CMakePM: Allow adding files to OBJECT libraries
Amends7a46bbe667
which only used `cmakeTarget->productType() != ProductType::Other` which excludes OBJECT libraries. Now the fix actually includes all targets which are not UtilityType, which was the intention of7a46bbe667
Fixes: QTCREATORBUG-29914 Change-Id: If661828e43d5c566c876546f5527c0b670405e47 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -217,10 +217,17 @@ 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
|
||||||
{
|
{
|
||||||
const auto cmakeTarget = dynamic_cast<CMakeTargetNode *>(context);
|
const auto cmakeTarget = dynamic_cast<CMakeTargetNode *>(context);
|
||||||
if (cmakeTarget && cmakeTarget->productType() != ProductType::Other)
|
if (cmakeTarget) {
|
||||||
return action == ProjectAction::AddNewFile || action == ProjectAction::AddExistingFile
|
const auto buildTarget = Utils::findOrDefault(m_buildTargets,
|
||||||
|| action == ProjectAction::AddExistingDirectory || action == ProjectAction::Rename
|
[cmakeTarget](const CMakeBuildTarget &bt) {
|
||||||
|| action == ProjectAction::RemoveFile;
|
return bt.title
|
||||||
|
== cmakeTarget->buildKey();
|
||||||
|
});
|
||||||
|
if (buildTarget.targetType != UtilityType)
|
||||||
|
return action == ProjectAction::AddNewFile || action == ProjectAction::AddExistingFile
|
||||||
|
|| action == ProjectAction::AddExistingDirectory
|
||||||
|
|| action == ProjectAction::Rename || action == ProjectAction::RemoveFile;
|
||||||
|
}
|
||||||
|
|
||||||
return BuildSystem::supportsAction(context, action, node);
|
return BuildSystem::supportsAction(context, action, node);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user