CMake: Always put in a CMakeLists.txt file

Even if there was none found by the project reader. This can happen
when the cmake binary can not be started at all with the server-mode
reader.

I wanted to avoid just creating this node as that does mess with the
expansion state of the tree. But considering that we know that the
tree is empty otherwise that should actually not be a problem.

Change-Id: I5ae5ed3e2fa7eebdfc1f9b7d55d70417abfcd125
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Tobias Hunger
2016-12-15 14:09:45 +01:00
parent 8f885a5b2e
commit f27b332f9c

View File

@@ -287,14 +287,8 @@ void BuildDirManager::generateProjectTree(CMakeListsNode *root, const QList<cons
// Make sure the top level CMakeLists.txt is always visible:
if (root->fileNodes().isEmpty()
&& root->folderNodes().isEmpty()
&& root->projectNodes().isEmpty()) {
const FileNode *cm = Utils::findOrDefault(allFiles, [&projectFile](const FileNode *fn) {
return fn->filePath() == projectFile;
});
if (cm) {
root->addFileNodes({ new FileNode(*cm) });
}
}
&& root->projectNodes().isEmpty())
root->addFileNodes({ new FileNode(projectFile, FileType::Project, false) });
}
QSet<Core::Id> BuildDirManager::updateCodeModel(CppTools::ProjectPartBuilder &ppBuilder)