diff options
author | Brad King <brad.king@kitware.com> | 2018-10-01 13:21:40 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-10-01 13:22:03 (GMT) |
commit | 5cf36d3b0f721f57d80750b4c05cc69d7d1fdc32 (patch) | |
tree | 5f1ff428cd71a057ad8f9f3c438c9848f85cc014 /Source | |
parent | 3bb8dda0479388277293d2d1949c1c294826d296 (diff) | |
parent | 80e2f8ee0c4f94e679a2e4cfa9123cc28bce2e4f (diff) | |
download | CMake-5cf36d3b0f721f57d80750b4c05cc69d7d1fdc32.zip CMake-5cf36d3b0f721f57d80750b4c05cc69d7d1fdc32.tar.gz CMake-5cf36d3b0f721f57d80750b4c05cc69d7d1fdc32.tar.bz2 |
Merge topic 'byproducts_make_clean'
80e2f8ee0c Ninja,Makefile: Add tests for handling of byproducts by clean operations
c7f1ed03d7 Help: Add release note for make clean and byproducts
4220962d18 Makefile: Add build events byproducts to clean rules
182d9597ec Makefile: Add custom command byproducts to clean rules
9c2b393cb7 Tests: Update CustomCommandWorkingDirectory to handle in-source byproducts
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2334
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index c8dc392..f423560 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -181,6 +181,36 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() this->LocalGenerator->MaybeConvertToRelativePath(currentBinDir, output)); } + const std::vector<std::string>& byproducts = ccg.GetByproducts(); + for (std::string const& byproduct : byproducts) { + this->CleanFiles.push_back( + this->LocalGenerator->MaybeConvertToRelativePath(currentBinDir, + byproduct)); + } + } + } + + // 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; |