Ninja: Make assumed source dependencies order-only

Since its beginning the Ninja generator has handled `GENERATED` source
files that have no custom command producing them by writing a dummy
custom command for them that depends on the target ordering phony edge.
Make the custom command's dependency order-only since the phony edge
also has only order-only dependencies.  The dummy custom command
should never be considered "dirty" by `ninja`.

Fixes: #17942
This commit is contained in:
Brad King
2018-04-25 12:57:03 -04:00
parent 625b8f9076
commit ee44f390ce

View File

@@ -931,12 +931,14 @@ void cmGlobalNinjaGenerator::AddDependencyToAll(const std::string& input)
void cmGlobalNinjaGenerator::WriteAssumedSourceDependencies()
{
for (auto const& asd : this->AssumedSourceDependencies) {
cmNinjaDeps deps;
std::copy(asd.second.begin(), asd.second.end(), std::back_inserter(deps));
cmNinjaDeps orderOnlyDeps;
std::copy(asd.second.begin(), asd.second.end(),
std::back_inserter(orderOnlyDeps));
WriteCustomCommandBuild(/*command=*/"", /*description=*/"",
"Assume dependencies for generated source file.",
/*depfile*/ "", /*uses_terminal*/ false,
/*restat*/ true, cmNinjaDeps(1, asd.first), deps);
/*restat*/ true, cmNinjaDeps(1, asd.first),
cmNinjaDeps(), orderOnlyDeps);
}
}