cmExecProgramCommand.h 1.5 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 cmExecProgramCommand_h
  4. #define cmExecProgramCommand_h
  5. #include <cmConfigure.h>
  6. #include <string>
  7. #include <vector>
  8. #include "cmCommand.h"
  9. class cmExecutionStatus;
  10. /** \class cmExecProgramCommand
  11. * \brief Command that adds a target to the build system.
  12. *
  13. * cmExecProgramCommand adds an extra target to the build system.
  14. * This is useful when you would like to add special
  15. * targets like "install,", "clean," and so on.
  16. */
  17. class cmExecProgramCommand : public cmCommand
  18. {
  19. public:
  20. /**
  21. * This is a virtual constructor for the command.
  22. */
  23. cmCommand* Clone() CM_OVERRIDE { return new cmExecProgramCommand; }
  24. /**
  25. * This is called when the command is first encountered in
  26. * the CMakeLists.txt file.
  27. */
  28. bool InitialPass(std::vector<std::string> const& args,
  29. cmExecutionStatus& status) CM_OVERRIDE;
  30. /**
  31. * The name of the command as specified in CMakeList.txt.
  32. */
  33. std::string GetName() const CM_OVERRIDE { return "exec_program"; }
  34. /**
  35. * This determines if the command is invoked when in script mode.
  36. */
  37. bool IsScriptable() const CM_OVERRIDE { return true; }
  38. private:
  39. static bool RunCommand(const char* command, std::string& output, int& retVal,
  40. const char* directory = CM_NULLPTR,
  41. bool verbose = true);
  42. };
  43. #endif