java-topology/defects/cmake/patch/cmake-0003-addruntimedll-unordered-set.patch

32 lines
1.2 KiB
Diff

# UNDF: UNDF-2026-000000034
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index abc1234..def5678 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -1,6 +1,7 @@
#pragma once
#include <map>
+#include <unordered_set>
#include <vector>
// ... (other includes unchanged)
@@ -180,7 +181,9 @@ private:
// DLL dependencies to copy at runtime (Windows/DLL platforms only).
// Populated by AddRuntimeDLL(), queried by GetRuntimeDLLs().
std::vector<cmGeneratorTarget const*> RuntimeDLLs;
+ // Shadow set for O(1) membership check in AddRuntimeDLL.
+ std::unordered_set<cmGeneratorTarget const*> RuntimeDLLsSet;
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index abc1234..def5678 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1350,8 +1350,9 @@ void cmComputeLinkInformation::AddRuntimeDLL(cmGeneratorTarget const* tgt)
{
- if (std::find(this->RuntimeDLLs.begin(), this->RuntimeDLLs.end(), tgt) ==
- this->RuntimeDLLs.end()) {
+ if (this->RuntimeDLLsSet.insert(tgt).second) {
this->RuntimeDLLs.emplace_back(tgt);
}
}