cmExportSet.cxx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #include "cmExportSet.h"
  4. #include <tuple>
  5. #include <utility>
  6. #include "cmLocalGenerator.h"
  7. #include "cmTargetExport.h"
  8. cmExportSet::cmExportSet(std::string name)
  9. : Name(std::move(name))
  10. {
  11. }
  12. cmExportSet::~cmExportSet() = default;
  13. void cmExportSet::Compute(cmLocalGenerator* lg)
  14. {
  15. for (std::unique_ptr<cmTargetExport>& tgtExport : this->TargetExports) {
  16. tgtExport->Target = lg->FindGeneratorTargetToUse(tgtExport->TargetName);
  17. }
  18. }
  19. void cmExportSet::AddTargetExport(std::unique_ptr<cmTargetExport> te)
  20. {
  21. this->TargetExports.emplace_back(std::move(te));
  22. }
  23. void cmExportSet::AddInstallation(cmInstallExportGenerator const* installation)
  24. {
  25. this->Installations.push_back(installation);
  26. }
  27. cmExportSet& cmExportSetMap::operator[](const std::string& name)
  28. {
  29. auto it = this->find(name);
  30. if (it == this->end()) // Export set not found
  31. {
  32. auto tup_name = std::make_tuple(name);
  33. it = this->emplace(std::piecewise_construct, tup_name, tup_name).first;
  34. }
  35. return it->second;
  36. }