cmCMakeHostSystemInformationCommand.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2013 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef cmCMakeHostSystemInformationCommand_h
  11. #define cmCMakeHostSystemInformationCommand_h
  12. #include "cmCommand.h"
  13. #include <cmsys/SystemInformation.hxx>
  14. /** \class cmCMakeHostSystemInformationCommand
  15. * \brief Query host system specific information
  16. *
  17. * cmCMakeHostSystemInformationCommand queries system information of
  18. * the sytem 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. virtual cmCommand* Clone()
  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. virtual bool InitialPass(std::vector<std::string> const& args,
  35. cmExecutionStatus &status);
  36. /**
  37. * This determines if the command is invoked when in script mode.
  38. */
  39. virtual bool IsScriptable() const { return true; }
  40. /**
  41. * The name of the command as specified in CMakeList.txt.
  42. */
  43. virtual const char* GetName() const
  44. {
  45. return "cmake_host_system_information";
  46. }
  47. cmTypeMacro(cmCMakeHostSystemInformationCommand, cmCommand);
  48. private:
  49. bool GetValue(cmsys::SystemInformation &info,
  50. std::string const& key, std::string &value);
  51. std::string ValueToString(size_t value) const;
  52. std::string ValueToString(const char *value) const;
  53. std::string ValueToString(std::string const& value) const;
  54. };
  55. #endif