cmExportSet.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmExportSet_h
  4. #define cmExportSet_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include <map>
  7. #include <memory>
  8. #include <string>
  9. #include <vector>
  10. class cmInstallExportGenerator;
  11. class cmLocalGenerator;
  12. class cmTargetExport;
  13. /// A set of targets that were installed with the same EXPORT parameter.
  14. class cmExportSet
  15. {
  16. public:
  17. /// Construct an empty export set named \a name
  18. cmExportSet(std::string name);
  19. /// Destructor
  20. ~cmExportSet();
  21. cmExportSet(const cmExportSet&) = delete;
  22. cmExportSet& operator=(const cmExportSet&) = delete;
  23. void Compute(cmLocalGenerator* lg);
  24. void AddTargetExport(std::unique_ptr<cmTargetExport> tgt);
  25. void AddInstallation(cmInstallExportGenerator const* installation);
  26. std::string const& GetName() const { return this->Name; }
  27. std::vector<std::unique_ptr<cmTargetExport>> const& GetTargetExports() const
  28. {
  29. return this->TargetExports;
  30. }
  31. std::vector<cmInstallExportGenerator const*> const* GetInstallations() const
  32. {
  33. return &this->Installations;
  34. }
  35. private:
  36. std::vector<std::unique_ptr<cmTargetExport>> TargetExports;
  37. std::string Name;
  38. std::vector<cmInstallExportGenerator const*> Installations;
  39. };
  40. /// A name -> cmExportSet map with overloaded operator[].
  41. class cmExportSetMap : public std::map<std::string, cmExportSet>
  42. {
  43. public:
  44. /** \brief Overloaded operator[].
  45. *
  46. * The operator is overloaded because cmExportSet has no default constructor:
  47. * we do not want unnamed export sets.
  48. */
  49. cmExportSet& operator[](const std::string& name);
  50. };
  51. #endif