CMake: Always list CMakeLists.txt files

Always list CMakeLists.txt files, even if CMake thinks they are part
of its own modules. This unbreaks opening the cmake project with
a cmake built from those sources.

Change-Id: Ia7245aa0fa39854fe228cdff75b2256115545b39
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Tobias Hunger
2016-12-15 13:39:00 +01:00
parent 1b2fc1c815
commit c41404728a

View File

@@ -291,6 +291,7 @@ void ServerModeReader::generateProjectTree(CMakeListsNode *root,
QList<FileNode *> cmakeFilesBuild;
QList<FileNode *> cmakeFilesOther;
QList<FileNode *> cmakeLists;
foreach (FileNode *fn, m_cmakeInputsFileNodes) {
const FileName path = fn->filePath();
if (path.fileName().compare("CMakeLists.txt", HostOsInfo::fileNameCaseSensitivity()) == 0)
@@ -511,8 +512,11 @@ void ServerModeReader::extractCMakeInputsData(const QVariantMap &data)
const FileName sfn = FileName::fromString(QDir::cleanPath(srcDir.absoluteFilePath(s)));
const int oldCount = m_cmakeFiles.count();
m_cmakeFiles.insert(sfn);
if (!isCMake && oldCount < m_cmakeFiles.count())
if (oldCount < m_cmakeFiles.count() && (!isCMake || sfn.toString().endsWith("/CMakeLists.txt"))) {
// Always include CMakeLists.txt files, even when cmake things these are part of its
// stuff. This unbreaks cmake binaries running from their own build directory.
m_cmakeInputsFileNodes.append(new FileNode(sfn, FileType::Project, isTemporary));
}
}
}
}