Autogen: Skip per-compilation dep reading when depfile merge is used

When a build-system depfile is in use, JobDepFilesMergeT already handles
reading and merging all moc dependency files. Skip the redundant
per-compilation dependency reading in JobCompileMocT to avoid duplicate
work.

This was caught by the Autogen_Qt6_3 Xcode test after enabling
depfiles for the Xcode generator. This test checks the exact number of
"AutoMoc:" verbose messages emitted during a build. The depfile merge
added a fifth message, exceeding the expected count of 4.
This commit is contained in:
Joerg Bornemann committed 2026-03-23 20:55:03 +01:00
1 parent 2dd7d06d70
commit d9f569c246
1 file changed
+5 -2
+5 -2
View File
@@ -2116,8 +2116,11 @@ void cmQtAutoMocUicT::JobCompileMocT::Process()
this->Log().Info(GenT::MOC, result.StdOut);
}
// Extract dependencies from the dep file moc generated for us
if (this->MocConst().CanOutputDependencies) {
// Extract dependencies from the dep file moc generated for us.
// When a build-system depfile is used, JobDepFilesMergeT handles reading
// and merging all moc dependencies, so skip per-compilation dep reading.
if (this->MocConst().CanOutputDependencies &&
this->BaseConst().DepFile.empty()) {
std::string const depfile = outputFile + ".d";
if (this->Log().Verbose()) {
this->Log().Info(