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

Function HandleFindCommand

Source/cmListCommand.cxx:296–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294}
295
296bool HandleFindCommand(std::vector<std::string> const& args,
297 cmExecutionStatus& status)
298{
299 if (args.size() != 4) {
300 status.SetError("sub-command FIND requires three arguments.");
301 return false;
302 }
303
304 std::string const& listName = args[1];
305 std::string const& variableName = args.back();
306 // expand the variable
307 auto list = GetList(listName, status.GetMakefile());
308
309 if (!list) {
310 status.GetMakefile().AddDefinition(variableName, "-1");
311 return true;
312 }
313
314 auto index = list->find(args[2]);
315 status.GetMakefile().AddDefinition(
316 variableName, index == cmList::npos ? "-1" : std::to_string(index));
317 return true;
318}
319
320bool HandleInsertCommand(std::vector<std::string> const& args,
321 cmExecutionStatus& status)

Callers

nothing calls this directly

Calls 8

to_stringFunction · 0.85
GetListFunction · 0.70
sizeMethod · 0.45
SetErrorMethod · 0.45
backMethod · 0.45
GetMakefileMethod · 0.45
AddDefinitionMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…