summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorAlexey Edelev <semlanik@gmail.com>2021-07-16 17:24:53 +0200
committerBrad King <brad.king@kitware.com>2021-07-19 13:28:16 -0400
commit9cebdbec77ac59a1394c3a28da43a7bf0bd37fe9 (patch)
treec9a9542978b03dfc99553973ae4817d5a66f5fd8 /Source
parent4ff651eb52215ca0e1ffe5e5356b56b57913fee0 (diff)
downloadcmake-9cebdbec77ac59a1394c3a28da43a7bf0bd37fe9.tar.gz
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
Diffstat (limited to 'Source')
-rw-r--r--Source/cmQtAutoMocUic.cxx20
1 files changed, 14 insertions, 6 deletions
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index f5c195fd1d..2753fd57c0 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());