cmExecProgramCommand.h 1.4 KB

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