summaryrefslogtreecommitdiff
path: root/Source/cmExportSet.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmExportSet.cxx')
-rw-r--r--Source/cmExportSet.cxx27
1 files changed, 21 insertions, 6 deletions
diff --git a/Source/cmExportSet.cxx b/Source/cmExportSet.cxx
index a6fa186c7..a20aa9a8a 100644
--- a/Source/cmExportSet.cxx
+++ b/Source/cmExportSet.cxx
@@ -2,28 +2,43 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmExportSet.h"
-#include "cmAlgorithms.h"
+#include <tuple>
+#include <utility>
+
#include "cmLocalGenerator.h"
#include "cmTargetExport.h"
-cmExportSet::~cmExportSet()
+cmExportSet::cmExportSet(std::string name)
+ : Name(std::move(name))
{
- cmDeleteAll(this->TargetExports);
}
+cmExportSet::~cmExportSet() = default;
+
void cmExportSet::Compute(cmLocalGenerator* lg)
{
- for (cmTargetExport* tgtExport : this->TargetExports) {
+ for (std::unique_ptr<cmTargetExport>& tgtExport : this->TargetExports) {
tgtExport->Target = lg->FindGeneratorTargetToUse(tgtExport->TargetName);
}
}
-void cmExportSet::AddTargetExport(cmTargetExport* te)
+void cmExportSet::AddTargetExport(std::unique_ptr<cmTargetExport> te)
{
- this->TargetExports.push_back(te);
+ this->TargetExports.emplace_back(std::move(te));
}
void cmExportSet::AddInstallation(cmInstallExportGenerator const* installation)
{
this->Installations.push_back(installation);
}
+
+cmExportSet& cmExportSetMap::operator[](const std::string& name)
+{
+ auto it = this->find(name);
+ if (it == this->end()) // Export set not found
+ {
+ auto tup_name = std::make_tuple(name);
+ it = this->emplace(std::piecewise_construct, tup_name, tup_name).first;
+ }
+ return it->second;
+}