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/cmMakefileLibraryTargetGenerator.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/cmMakefileLibraryTargetGenerator.cxx')
-rw-r--r-- | Source/cmMakefileLibraryTargetGenerator.cxx | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 0393e22..f5d1fc9 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -4,6 +4,7 @@ #include <algorithm> #include <memory> // IWYU pragma: keep +#include <set> #include <sstream> #include <stddef.h> #include <utility> @@ -304,8 +305,8 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules( commands, buildEcho, cmLocalUnixMakefileGenerator3::EchoLink, &progress); } // Clean files associated with this library. - std::vector<std::string> libCleanFiles; - libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( + std::set<std::string> libCleanFiles; + libCleanFiles.insert(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), targetOutputReal)); // Determine whether a link script will be used. @@ -412,8 +413,7 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules( this->LocalGenerator->SetLinkScriptShell(false); // Clean all the possible library names and symlinks. - this->CleanFiles.insert(this->CleanFiles.end(), libCleanFiles.begin(), - libCleanFiles.end()); + this->CleanFiles.insert(libCleanFiles.begin(), libCleanFiles.end()); } std::vector<std::string> commands1; @@ -593,8 +593,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( } // Clean files associated with this library. - std::vector<std::string> libCleanFiles; - libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( + std::set<std::string> libCleanFiles; + libCleanFiles.insert(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathReal)); std::vector<std::string> commands1; @@ -611,22 +611,22 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( } if (this->TargetNames.Output != this->TargetNames.Real) { - libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( + libCleanFiles.insert(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPath)); } if (this->TargetNames.SharedObject != this->TargetNames.Real && this->TargetNames.SharedObject != this->TargetNames.Output) { - libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( + libCleanFiles.insert(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathSO)); } if (!this->TargetNames.ImportLibrary.empty()) { - libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( + libCleanFiles.insert(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathImport)); std::string implib; if (this->GeneratorTarget->GetImplibGNUtoMS( this->ConfigName, targetFullPathImport, implib)) { - libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( + libCleanFiles.insert(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), implib)); } } @@ -634,14 +634,14 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( // List the PDB for cleaning only when the whole target is // cleaned. We do not want to delete the .pdb file just before // linking the target. - this->CleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( + this->CleanFiles.insert(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPathPDB)); #ifdef _WIN32 // There may be a manifest file for this target. Add it to the // clean set just in case. if (this->GeneratorTarget->GetType() != cmStateEnums::STATIC_LIBRARY) { - libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( + libCleanFiles.insert(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), targetFullPath + ".manifest")); } @@ -992,6 +992,5 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( this->WriteTargetDriverRule(targetFullPath, relink); // Clean all the possible library names and symlinks. - this->CleanFiles.insert(this->CleanFiles.end(), libCleanFiles.begin(), - libCleanFiles.end()); + this->CleanFiles.insert(libCleanFiles.begin(), libCleanFiles.end()); } |