From 9cebdbec77ac59a1394c3a28da43a7bf0bd37fe9 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Fri, 16 Jul 2021 17:24:53 +0200 Subject: AUTOUIC: Fix cyclic dependency between generated UI headers and timestamp Once the generated UI headers are created by UIC they also are involved into processing in next run on ninja. Autogen adds `ui_*.h` files to the deps file `ui_*.h` and this cause timestamp start depend on `ui_*.h`. Meanwhile `ui_*.h` depend on timestamp because of the explicit rules added by commit 1265c65b33 (AUTOUIC: Collect ui header files for Ninja generator, 2021-02-18, v3.21.0-rc1~600^2). Avoid adding `ui_*.h` to deps file at second ninja run. Fixes: #16776 --- Source/cmQtAutoMocUic.cxx | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx index f5c195f..2753fd5 100644 --- a/Source/cmQtAutoMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -2248,12 +2248,20 @@ void cmQtAutoMocUicT::JobDepFilesMergeT::Process() std::for_each(this->MocEval().SourceMappings.begin(), this->MocEval().SourceMappings.end(), processMappingEntry); - // Remove SKIP_AUTOMOC files - dependencies.erase(std::remove_if(dependencies.begin(), dependencies.end(), - [this](const std::string& dep) { - return this->MocConst().skipped(dep); - }), - dependencies.end()); + // Remove SKIP_AUTOMOC files. + // Also remove AUTOUIC header files to avoid cyclic dependency. + dependencies.erase( + std::remove_if(dependencies.begin(), dependencies.end(), + [this](const std::string& dep) { + return this->MocConst().skipped(dep) || + std::any_of( + this->UicEval().Includes.begin(), + this->UicEval().Includes.end(), + [&dep](MappingMapT::value_type const& mapping) { + return dep == mapping.second->OutputFile; + }); + }), + dependencies.end()); // Remove duplicates to make the depfile smaller std::sort(dependencies.begin(), dependencies.end()); -- cgit v0.12