CMake: Fix setting additional project files for file watching

Amends d8be2491a5

The change above introduced FileApiReader::takeCMakeFileInfos and uses
it to move the information about additional CMake files out of the
FileApiReader. But that now emptied variable was later used to inform
the project about these additional files. So, that broke the automatic
running of CMake when project files (except the toplevel one) changes.
Instead use the list of additional files that now lives in the
CMakeBuildSystem for that purpose.

Change-Id: I1062593029880af9d4c70e72e1bd101d40ad0c00
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Eike Ziller
2023-05-08 13:37:07 +02:00
parent 41b6ecf502
commit bd660aaf27
3 changed files with 10 additions and 10 deletions

View File

@@ -872,13 +872,22 @@ void CMakeBuildSystem::checkAndReportError(QString &errorMessage)
}
}
static QSet<FilePath> projectFilesToWatch(const QSet<CMakeFileInfo> &cmakeFiles)
{
return Utils::transform(Utils::filtered(cmakeFiles,
[](const CMakeFileInfo &info) {
return !info.isGenerated;
}),
[](const CMakeFileInfo &info) { return info.path; });
}
void CMakeBuildSystem::updateProjectData()
{
qCDebug(cmakeBuildSystemLog) << "Updating CMake project data";
QTC_ASSERT(m_treeScanner.isFinished() && !m_reader.isParsing(), return );
buildConfiguration()->project()->setExtraProjectFiles(m_reader.projectFilesToWatch());
buildConfiguration()->project()->setExtraProjectFiles(projectFilesToWatch(m_cmakeFiles));
CMakeConfig patchedConfig = configurationFromCMake();
{