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

Function cmCMakeLanguageCommandCALL

Source/cmCMakeLanguageCommand.cxx:65–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63};
64
65bool cmCMakeLanguageCommandCALL(std::vector<cmListFileArgument> const& args,
66 std::string const& callCommand,
67 size_t startArg, cm::optional<Defer> defer,
68 cmExecutionStatus& status)
69{
70 // ensure specified command is valid
71 // start/end flow control commands are not allowed
72 auto cmd = cmSystemTools::LowerCase(callCommand);
73 if (std::find(InvalidCommands.cbegin(), InvalidCommands.cend(), cmd) !=
74 InvalidCommands.cend()) {
75 return FatalError(status,
76 cmStrCat("invalid command specified: "_s, callCommand));
77 }
78 if (defer &&
79 std::find(InvalidDeferCommands.cbegin(), InvalidDeferCommands.cend(),
80 cmd) != InvalidDeferCommands.cend()) {
81 return FatalError(status,
82 cmStrCat("invalid command specified: "_s, callCommand));
83 }
84
85 cmMakefile& makefile = status.GetMakefile();
86 cmListFileContext context = makefile.GetBacktrace().Top();
87
88 std::vector<cmListFileArgument> funcArgs;
89 funcArgs.reserve(args.size() - startArg);
90
91 // The rest of the arguments are passed to the function call above
92 for (size_t i = startArg; i < args.size(); ++i) {
93 funcArgs.emplace_back(args[i].Value, args[i].Delim, context.Line);
94 }
95 cmListFileFunction func{ callCommand, context.Line, context.Line,
96 std::move(funcArgs) };
97
98 if (defer) {
99 if (defer->Id.empty()) {
100 defer->Id = makefile.NewDeferId();
101 }
102 if (!defer->IdVar.empty()) {
103 makefile.AddDefinition(defer->IdVar, defer->Id);
104 }
105 cmMakefile* deferMakefile =
106 defer->Directory ? defer->Directory : &makefile;
107 if (!deferMakefile->DeferCall(defer->Id, context.FilePath, func)) {
108 return FatalError(
109 status,
110 cmStrCat("DEFER CALL may not be scheduled in directory:\n "_s,
111 deferMakefile->GetCurrentBinaryDirectory(),
112 "\nat this time."_s));
113 }
114 return true;
115 }
116 return makefile.ExecuteCommand(func, status);
117}
118
119bool cmCMakeLanguageCommandDEFER(Defer const& defer,
120 std::vector<std::string> const& args,

Callers 1

cmCMakeLanguageCommandFunction · 0.85

Calls 15

FatalErrorFunction · 0.85
moveFunction · 0.85
cbeginMethod · 0.80
cendMethod · 0.80
reserveMethod · 0.80
emplace_backMethod · 0.80
DeferCallMethod · 0.80
ExecuteCommandMethod · 0.80
cmStrCatFunction · 0.70
findFunction · 0.50
GetMakefileMethod · 0.45
GetBacktraceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…