diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2019-05-13 10:54:45 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2019-05-14 15:50:13 (GMT) |
commit | 7c8c18b1e61ca717941214c2365ce5c5056bad14 (patch) | |
tree | f78b3d9e5936d5af851dbdd32647b68e25fad468 /Source/cmMakefileTargetGenerator.cxx | |
parent | 1f0a695561f12b8e3929066d7dc61535a20af66c (diff) | |
download | CMake-7c8c18b1e61ca717941214c2365ce5c5056bad14.zip CMake-7c8c18b1e61ca717941214c2365ce5c5056bad14.tar.gz CMake-7c8c18b1e61ca717941214c2365ce5c5056bad14.tar.bz2 |
Makefiles: Sort clean files by using a std::set<std::string> container
By using a `std::set<std::string>` container instead of a
`std::vector<std::string>` container, the clean files list becomes sorted and
unique. The clean target in Makefiles beomes nicer and better readable this
way. Also double clean entries won't appear anymore.
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 340e405..2ea6682 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -158,10 +158,12 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(additional_clean_files); + std::vector<std::string> additionalFiles; cmSystemTools::ExpandListArgument( cge->Evaluate(this->LocalGenerator, config, false, this->GeneratorTarget, nullptr, nullptr), - this->CleanFiles); + additionalFiles); + this->CleanFiles.insert(additionalFiles.begin(), additionalFiles.end()); } // add custom commands to the clean rules? @@ -181,13 +183,13 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() if (clean) { const std::vector<std::string>& outputs = ccg.GetOutputs(); for (std::string const& output : outputs) { - this->CleanFiles.push_back( + this->CleanFiles.insert( this->LocalGenerator->MaybeConvertToRelativePath(currentBinDir, output)); } const std::vector<std::string>& byproducts = ccg.GetByproducts(); for (std::string const& byproduct : byproducts) { - this->CleanFiles.push_back( + this->CleanFiles.insert( this->LocalGenerator->MaybeConvertToRelativePath(currentBinDir, byproduct)); } @@ -211,7 +213,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() for (const auto& be : buildEventCommands) { const std::vector<std::string>& byproducts = be.GetByproducts(); for (std::string const& byproduct : byproducts) { - this->CleanFiles.push_back( + this->CleanFiles.insert( this->LocalGenerator->MaybeConvertToRelativePath(currentBinDir, byproduct)); } @@ -350,7 +352,7 @@ void cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()( std::string output = macdir; output += "/"; output += cmSystemTools::GetFilenameName(input); - this->Generator->CleanFiles.push_back( + this->Generator->CleanFiles.insert( this->Generator->LocalGenerator->MaybeConvertToRelativePath( this->Generator->LocalGenerator->GetCurrentBinaryDirectory(), output)); output = this->Generator->LocalGenerator->MaybeConvertToRelativePath( @@ -415,7 +417,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles( // Save this in the target's list of object files. this->Objects.push_back(obj); - this->CleanFiles.push_back(obj); + this->CleanFiles.insert(obj); // TODO: Remove // std::string relativeObj @@ -804,8 +806,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( if (const char* extra_outputs_str = source.GetProperty("OBJECT_OUTPUTS")) { // Register these as extra files to clean. cmSystemTools::ExpandListArgument(extra_outputs_str, outputs); - this->CleanFiles.insert(this->CleanFiles.end(), outputs.begin() + 1, - outputs.end()); + this->CleanFiles.insert(outputs.begin() + 1, outputs.end()); } // Write the rule. |