cmExecProgramCommand.h 1.31 KB
Newer Older
1 2
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
   file Copyright.txt or https://cmake.org/licensing for details.  */
3 4
#ifndef cmExecProgramCommand_h
#define cmExecProgramCommand_h
5

6
#include "cmConfigure.h" // IWYU pragma: keep
7

8 9 10
#include <string>
#include <vector>

11
#include "cmCommand.h"
12
#include "cmProcessOutput.h"
13

14 15
class cmExecutionStatus;

16
/** \class cmExecProgramCommand
17 18
 * \brief Command that adds a target to the build system.
 *
19
 * cmExecProgramCommand adds an extra target to the build system.
20 21 22
 * This is useful when you would like to add special
 * targets like "install,", "clean," and so on.
 */
23
class cmExecProgramCommand : public cmCommand
24 25
{
public:
26
  typedef cmProcessOutput::Encoding Encoding;
27 28 29
  /**
   * This is a virtual constructor for the command.
   */
30
  cmCommand* Clone() override { return new cmExecProgramCommand; }
31 32 33 34 35

  /**
   * This is called when the command is first encountered in
   * the CMakeLists.txt file.
   */
36
  bool InitialPass(std::vector<std::string> const& args,
37
                   cmExecutionStatus& status) override;
38

39
private:
40
  static bool RunCommand(std::string command, std::string& output, int& retVal,
Daniel Pfeifer's avatar
Daniel Pfeifer committed
41
                         const char* directory = nullptr, bool verbose = true,
42
                         Encoding encoding = cmProcessOutput::Auto);
43 44 45
};

#endif