cmExecProgramCommand.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 cmExecProgramCommand_h
  4. #define cmExecProgramCommand_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include <string>
  7. #include <vector>
  8. #include "cmCommand.h"
  9. #include "cmProcessOutput.h"
  10. class cmExecutionStatus;
  11. /** \class cmExecProgramCommand
  12. * \brief Command that adds a target to the build system.
  13. *
  14. * cmExecProgramCommand adds an extra target to the build system.
  15. * This is useful when you would like to add special
  16. * targets like "install,", "clean," and so on.
  17. */
  18. class cmExecProgramCommand : public cmCommand
  19. {
  20. public:
  21. typedef cmProcessOutput::Encoding Encoding;
  22. /**
  23. * This is a virtual constructor for the command.
  24. */
  25. cmCommand* Clone() override { return new cmExecProgramCommand; }
  26. /**
  27. * This is called when the command is first encountered in
  28. * the CMakeLists.txt file.
  29. */
  30. bool InitialPass(std::vector<std::string> const& args,
  31. cmExecutionStatus& status) override;
  32. private:
  33. static bool RunCommand(const char* command, std::string& output, int& retVal,
  34. const char* directory = nullptr, bool verbose = true,
  35. Encoding encoding = cmProcessOutput::Auto);
  36. };
  37. #endif