summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2023-11-18 03:44:45 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2023-11-21 14:42:58 (GMT)
commitb34a8fcb8ef434183c1a5ab26b46165a854822a9 (patch)
tree24a206713b961ba80f5bccef085db0adcafef626
parent6fe8b84894e356501a09eab93e42581fa126a833 (diff)
downloadCMake-b34a8fcb8ef434183c1a5ab26b46165a854822a9.zip
CMake-b34a8fcb8ef434183c1a5ab26b46165a854822a9.tar.gz
CMake-b34a8fcb8ef434183c1a5ab26b46165a854822a9.tar.bz2
cmGeneratorTarget: track object libraries using a `set`
This avoids having to do manual "is already present" checks. The order the targets are processed does not need to be preserved because the resulting `languages` result is already a `set`.
-rw-r--r--Source/cmGeneratorTarget.cxx14
1 files changed, 4 insertions, 10 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 930922c..372caab 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -8044,27 +8044,21 @@ void cmGeneratorTarget::GetLanguages(std::set<std::string>& languages,
}
}
- std::vector<cmGeneratorTarget*> objectLibraries;
- std::vector<cmSourceFile const*> externalObjects;
+ std::set<cmGeneratorTarget*> objectLibraries;
if (!this->GlobalGenerator->GetConfigureDoneCMP0026()) {
std::vector<cmGeneratorTarget*> objectTargets;
this->GetObjectLibrariesCMP0026(objectTargets);
- objectLibraries.reserve(objectTargets.size());
for (cmGeneratorTarget* gt : objectTargets) {
- objectLibraries.push_back(gt);
+ objectLibraries.insert(gt);
}
} else {
+ std::vector<cmSourceFile const*> externalObjects;
this->GetExternalObjects(externalObjects, config);
for (cmSourceFile const* extObj : externalObjects) {
std::string objLib = extObj->GetObjectLibrary();
if (cmGeneratorTarget* tgt =
this->LocalGenerator->FindGeneratorTargetToUse(objLib)) {
- auto const objLibIt =
- std::find_if(objectLibraries.cbegin(), objectLibraries.cend(),
- [tgt](cmGeneratorTarget* t) { return t == tgt; });
- if (objectLibraries.cend() == objLibIt) {
- objectLibraries.push_back(tgt);
- }
+ objectLibraries.insert(tgt);
}
}
}