forked from qt-creator/qt-creator
CMakeProjectManager: Add lib and app binaries to project tree
Task-number: QTCREATORBUG-28815 Change-Id: I58ebcd2a6935eb4b6746b5fd58e6ab8b97fdef43 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -198,6 +198,10 @@ void CMakeTargetNode::setTargetInformation(const QList<FilePath> &artifacts, con
|
||||
m_tooltip += Tr::tr("Build artifacts:") + "<br>" + tmp.join("<br>");
|
||||
m_artifact = artifacts.first();
|
||||
}
|
||||
if (type == "EXECUTABLE")
|
||||
setProductType(ProductType::App);
|
||||
else if (type == "SHARED_LIBRARY" || type == "STATIC_LIBRARY")
|
||||
setProductType(ProductType::Lib);
|
||||
}
|
||||
|
||||
} // CMakeProjectManager::Internal
|
||||
|
||||
@@ -605,6 +605,28 @@ void addCompileGroups(ProjectNode *targetRoot,
|
||||
std::move(otherFileNodes));
|
||||
}
|
||||
|
||||
static void addGeneratedFilesNode(ProjectNode *targetRoot, const FilePath &topLevelBuildDir,
|
||||
const TargetDetails &td)
|
||||
{
|
||||
if (td.artifacts.isEmpty())
|
||||
return;
|
||||
FileType type = FileType::Unknown;
|
||||
if (td.type == "EXECUTABLE")
|
||||
type = FileType::App;
|
||||
else if (td.type == "SHARED_LIBRARY" || td.type == "STATIC_LIBRARY")
|
||||
type = FileType::Lib;
|
||||
if (type == FileType::Unknown)
|
||||
return;
|
||||
std::vector<std::unique_ptr<FileNode>> nodes;
|
||||
const FilePath buildDir = topLevelBuildDir.resolvePath(td.buildDir);
|
||||
for (const FilePath &artifact : td.artifacts) {
|
||||
nodes.emplace_back(new FileNode(buildDir.resolvePath(artifact), type));
|
||||
type = FileType::Unknown;
|
||||
nodes.back()->setIsGenerated(true);
|
||||
}
|
||||
addCMakeVFolder(targetRoot, buildDir, 10, Tr::tr("<Generated Files>"), std::move(nodes));
|
||||
}
|
||||
|
||||
void addTargets(const QHash<Utils::FilePath, ProjectExplorer::ProjectNode *> &cmakeListsNodes,
|
||||
const Configuration &config,
|
||||
const std::vector<TargetDetails> &targetDetails,
|
||||
@@ -635,6 +657,7 @@ void addTargets(const QHash<Utils::FilePath, ProjectExplorer::ProjectNode *> &cm
|
||||
tNode->setBuildDirectory(directoryBuildDir(config, buildDir, t.directory));
|
||||
|
||||
addCompileGroups(tNode, sourceDir, dir, tNode->buildDirectory(), td);
|
||||
addGeneratedFilesNode(tNode, buildDir, td);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user