Makefile: Add build events byproducts to clean rules

This commit is contained in:
Pedro Navarro
2018-08-30 15:34:24 -07:00
committed by Brad King
parent 182d9597ec
commit 4220962d18

View File

@@ -189,6 +189,30 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
}
}
}
// Add byproducts from build events to the clean rules
if (clean) {
std::vector<cmCustomCommand> buildEventCommands =
this->GeneratorTarget->GetPreBuildCommands();
buildEventCommands.insert(
buildEventCommands.end(),
this->GeneratorTarget->GetPreLinkCommands().begin(),
this->GeneratorTarget->GetPreLinkCommands().end());
buildEventCommands.insert(
buildEventCommands.end(),
this->GeneratorTarget->GetPostBuildCommands().begin(),
this->GeneratorTarget->GetPostBuildCommands().end());
for (const auto& be : buildEventCommands) {
const std::vector<std::string>& byproducts = be.GetByproducts();
for (std::string const& byproduct : byproducts) {
this->CleanFiles.push_back(
this->LocalGenerator->MaybeConvertToRelativePath(currentBinDir,
byproduct));
}
}
}
std::vector<cmSourceFile const*> headerSources;
this->GeneratorTarget->GetHeaderSources(headerSources, config);
this->OSXBundleGenerator->GenerateMacOSXContentStatements(