MCPcopy Create free account
hub / github.com/Kitware/CMake / cmExecProgramCommand

Function cmExecProgramCommand

Source/cmExecProgramCommand.cxx:24–122  ·  view source on GitHub ↗

cmExecProgramCommand

Source from the content-addressed store, hash-verified

22
23// cmExecProgramCommand
24bool cmExecProgramCommand(std::vector<std::string> const& args,
25 cmExecutionStatus& status)
26{
27 if (args.empty()) {
28 status.SetError("called with incorrect number of arguments");
29 return false;
30 }
31 std::string arguments;
32 bool doingargs = false;
33 int count = 0;
34 std::string output_variable;
35 bool haveoutput_variable = false;
36 std::string return_variable;
37 bool havereturn_variable = false;
38 for (std::string const& arg : args) {
39 if (arg == "OUTPUT_VARIABLE") {
40 count++;
41 doingargs = false;
42 havereturn_variable = false;
43 haveoutput_variable = true;
44 } else if (haveoutput_variable) {
45 if (!output_variable.empty()) {
46 status.SetError("called with incorrect number of arguments");
47 return false;
48 }
49 output_variable = arg;
50 haveoutput_variable = false;
51 count++;
52 } else if (arg == "RETURN_VALUE") {
53 count++;
54 doingargs = false;
55 haveoutput_variable = false;
56 havereturn_variable = true;
57 } else if (havereturn_variable) {
58 if (!return_variable.empty()) {
59 status.SetError("called with incorrect number of arguments");
60 return false;
61 }
62 return_variable = arg;
63 havereturn_variable = false;
64 count++;
65 } else if (arg == "ARGS") {
66 count++;
67 havereturn_variable = false;
68 haveoutput_variable = false;
69 doingargs = true;
70 } else if (doingargs) {
71 arguments += arg;
72 arguments += " ";
73 count++;
74 }
75 }
76
77 std::string command;
78 if (!arguments.empty()) {
79 command = cmStrCat(cmSystemTools::ConvertToRunCommandPath(args[0]), ' ',
80 arguments);
81 } else {

Callers

nothing calls this directly

Calls 11

c_strMethod · 0.80
find_first_not_ofMethod · 0.80
find_last_not_ofMethod · 0.80
cmStrCatFunction · 0.70
RunCommandFunction · 0.70
snprintfFunction · 0.50
emptyMethod · 0.45
SetErrorMethod · 0.45
sizeMethod · 0.45
AddDefinitionMethod · 0.45
GetMakefileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…