cmCMakeHostSystemInformationCommand.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 cmCMakeHostSystemInformationCommand_h
  4. #define cmCMakeHostSystemInformationCommand_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include <stddef.h>
  7. #include <string>
  8. #include <vector>
  9. #include "cmCommand.h"
  10. class cmExecutionStatus;
  11. namespace cmsys {
  12. class SystemInformation;
  13. } // namespace cmsys
  14. /** \class cmCMakeHostSystemInformationCommand
  15. * \brief Query host system specific information
  16. *
  17. * cmCMakeHostSystemInformationCommand queries system information of
  18. * the system on which CMake runs.
  19. */
  20. class cmCMakeHostSystemInformationCommand : public cmCommand
  21. {
  22. public:
  23. /**
  24. * This is a virtual constructor for the command.
  25. */
  26. cmCommand* Clone() override
  27. {
  28. return new cmCMakeHostSystemInformationCommand;
  29. }
  30. /**
  31. * This is called when the command is first encountered in
  32. * the CMakeLists.txt file.
  33. */
  34. bool InitialPass(std::vector<std::string> const& args,
  35. cmExecutionStatus& status) override;
  36. private:
  37. bool GetValue(cmsys::SystemInformation& info, std::string const& key,
  38. std::string& value);
  39. std::string ValueToString(size_t value) const;
  40. std::string ValueToString(const char* value) const;
  41. std::string ValueToString(std::string const& value) const;
  42. };
  43. #endif