cmVersion.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file LICENSE.rst or https://cmake.org/licensing for details. */
  3. #pragma once
  4. #include <string>
  5. #include <vector>
  6. /** \class cmVersion
  7. * \brief Helper class for providing CMake and CTest version information.
  8. *
  9. * Finds all version related information.
  10. */
  11. class cmVersion
  12. {
  13. public:
  14. enum class DependencyType
  15. {
  16. System,
  17. Bundled,
  18. };
  19. struct DependencyInfo
  20. {
  21. /**
  22. * The name of the dependency.
  23. * e.g. "curl", "libarchive", "zlib", etc.
  24. */
  25. std::string name;
  26. /**
  27. * The version of the dependency if available.
  28. * e.g. "7.66.0", "3.8.0", "1.2.12", etc.
  29. */
  30. std::string version;
  31. /**
  32. * The type of the dependency.
  33. */
  34. DependencyType type;
  35. /**
  36. * The source of the dependency.
  37. * e.g. "curl", "libarchive", etc.
  38. * Empty if the dependency is directly passed from CMake.
  39. */
  40. std::string cameFrom;
  41. };
  42. /**
  43. * Return major and minor version numbers for cmake.
  44. */
  45. static unsigned int GetMajorVersion();
  46. static unsigned int GetMinorVersion();
  47. static unsigned int GetPatchVersion();
  48. static unsigned int GetTweakVersion();
  49. static char const* GetCMakeVersion();
  50. static std::vector<DependencyInfo> const& CollectDependencyInfo();
  51. };