diff options
author | Brad King <brad.king@kitware.com> | 2020-09-10 13:45:47 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-09-10 13:45:52 (GMT) |
commit | 8fe4d18e1a12f0fcd1cbfc4a82f67e3b2804427d (patch) | |
tree | 750dd3978a2c59ba9e8fcff627a32f5b296909c9 /Source | |
parent | 67355ac5de3428bfab259ba59067c307ee843183 (diff) | |
parent | 9ac3503d30ed46c63c6a733304072d316f0042cf (diff) | |
download | CMake-8fe4d18e1a12f0fcd1cbfc4a82f67e3b2804427d.zip CMake-8fe4d18e1a12f0fcd1cbfc4a82f67e3b2804427d.tar.gz CMake-8fe4d18e1a12f0fcd1cbfc4a82f67e3b2804427d.tar.bz2 |
Merge topic 'automoc-rerun-missing-dependency'
9ac3503d30 AutoMoc: Re-run moc if a dependency is missing
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5180
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmQtAutoMocUic.cxx | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx index 71c288c..9cb172b 100644 --- a/Source/cmQtAutoMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -192,7 +192,7 @@ public: { public: // -- Parse Cache - bool ParseCacheChanged = false; + std::atomic<bool> ParseCacheChanged = ATOMIC_VAR_INIT(false); cmFileTime ParseCacheTime; ParseCacheT ParseCache; @@ -1777,16 +1777,24 @@ bool cmQtAutoMocUicT::JobProbeDepsMocT::Probe(MappingT const& mapping, { // Check dependency timestamps std::string const sourceDir = SubDirPrefix(sourceFile); - for (std::string const& dep : mapping.SourceFile->ParseData->Moc.Depends) { + auto& dependencies = mapping.SourceFile->ParseData->Moc.Depends; + for (auto it = dependencies.begin(); it != dependencies.end(); ++it) { + auto& dep = *it; + // Find dependency file auto const depMatch = FindDependency(sourceDir, dep); if (depMatch.first.empty()) { - Log().Warning(GenT::MOC, - cmStrCat(MessagePath(sourceFile), " depends on ", - MessagePath(dep), - " but the file does not exist.")); - continue; + if (reason != nullptr) { + *reason = + cmStrCat("Generating ", MessagePath(outputFile), " from ", + MessagePath(sourceFile), ", because its dependency ", + MessagePath(dep), " vanished."); + } + dependencies.erase(it); + BaseEval().ParseCacheChanged = true; + return true; } + // Test if dependency file is older if (outputFileTime.Older(depMatch.second)) { if (reason != nullptr) { |