1
0

cmExecProgramCommand.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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>
  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() CM_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) CM_OVERRIDE;
  32. /**
  33. * The name of the command as specified in CMakeList.txt.
  34. */
  35. std::string GetName() const CM_OVERRIDE { return "exec_program"; }
  36. /**
  37. * This determines if the command is invoked when in script mode.
  38. */
  39. bool IsScriptable() const CM_OVERRIDE { return true; }
  40. private:
  41. static bool RunCommand(const char* command, std::string& output, int& retVal,
  42. const char* directory = CM_NULLPTR,
  43. bool verbose = true,
  44. Encoding encoding = cmProcessOutput::Auto);
  45. };
  46. #endif