cmake/Source/cmExportSet.cxx

45 lines
1.1 KiB
C++
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
2013-03-16 19:13:01 +02:00
#include "cmExportSet.h"
2016-07-09 11:21:54 +02:00
2020-02-01 23:06:01 +01:00
#include <tuple>
#include <utility>
2016-03-13 13:35:51 +01:00
#include "cmLocalGenerator.h"
2016-07-09 11:21:54 +02:00
#include "cmTargetExport.h"
2013-03-16 19:13:01 +02:00
2020-02-01 23:06:01 +01:00
cmExportSet::cmExportSet(std::string name)
: Name(std::move(name))
2013-03-16 19:13:01 +02:00
{
}
2020-02-01 23:06:01 +01:00
cmExportSet::~cmExportSet() = default;
2016-03-13 13:35:51 +01:00
void cmExportSet::Compute(cmLocalGenerator* lg)
{
2020-02-01 23:06:01 +01:00
for (std::unique_ptr<cmTargetExport>& tgtExport : this->TargetExports) {
2018-01-26 17:06:56 +01:00
tgtExport->Target = lg->FindGeneratorTargetToUse(tgtExport->TargetName);
2016-07-09 11:21:54 +02:00
}
2016-03-13 13:35:51 +01:00
}
2020-02-01 23:06:01 +01:00
void cmExportSet::AddTargetExport(std::unique_ptr<cmTargetExport> te)
2013-03-16 19:13:01 +02:00
{
2020-02-01 23:06:01 +01:00
this->TargetExports.emplace_back(std::move(te));
2013-03-16 19:13:01 +02:00
}
void cmExportSet::AddInstallation(cmInstallExportGenerator const* installation)
{
this->Installations.push_back(installation);
}
2020-02-01 23:06:01 +01:00
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;
}