Commit a7cbae1e authored by Tobias Hunger's avatar Tobias Hunger

CMake: Make sure top level CMakeLists.txt file is listed exactly once

The toplevel CMakeLists.txt file should always be visible in the project tree,
otherwise there is no way to fix problems that stop creator from reading the
project structure.

Since the cmake configuration may add that file itself, creator needs to
check before adding that file. All other files are taken straight from
cmake, which makes sure they are unique.

See the minimal project attached to QTCREATORBUG-16671 for an example
triggering this issue.

Change-Id: Iff3e307134b023e6955f47657e998a5981b03da0
Reviewed-by: Eike Ziller's avatarEike Ziller <eike.ziller@qt.io>
parent 906e81c7
......@@ -382,7 +382,10 @@ void BuildDirManager::extractData()
m_files.append(cbpparser.cmakeFileList());
foreach (const ProjectExplorer::FileNode *node, cbpparser.cmakeFileList())
m_cmakeFiles.insert(node->filePath());
} else {
}
// Make sure the top cmakelists.txt file is always listed:
if (!Utils::contains(m_files, [topCMake](ProjectExplorer::FileNode *fn) { return fn->filePath() == topCMake; })) {
m_files.append(new ProjectExplorer::FileNode(topCMake, ProjectExplorer::ProjectFileType, false));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment