From 0b65a2b2531b05abe1bc1f1950bb963af7a6d42f Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Sun, 16 Jan 2022 14:04:05 +0100 Subject: add_custom_command(DEPFILE): ensure all dependencies are taken into account --- Source/cmDependsCompiler.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Source/cmDependsCompiler.cxx') diff --git a/Source/cmDependsCompiler.cxx b/Source/cmDependsCompiler.cxx index bf599ffaf0..0cc4946e48 100644 --- a/Source/cmDependsCompiler.cxx +++ b/Source/cmDependsCompiler.cxx @@ -4,6 +4,7 @@ #include "cmDependsCompiler.h" #include +#include #include #include #include @@ -111,9 +112,13 @@ bool cmDependsCompiler::CheckDependencies( // copy depends for each target, except first one, which can be // moved for (auto index = entry.rules.size() - 1; index > 0; --index) { - dependencies[entry.rules[index]] = depends; + auto& rule_deps = dependencies[entry.rules[index]]; + rule_deps.insert(rule_deps.end(), depends.cbegin(), + depends.cend()); } - dependencies[entry.rules.front()] = std::move(depends); + auto& rule_deps = dependencies[entry.rules.front()]; + std::move(depends.cbegin(), depends.cend(), + std::back_inserter(rule_deps)); } } else { if (format == "msvc"_s) { -- cgit v1.2.1