cmCMakeHostSystemInformationCommand.h 1.4 KB

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