MCPcopy Index your code
hub / github.com/Kitware/CMake / HandleInsertCommand

Function HandleInsertCommand

Source/cmListCommand.cxx:320–350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

318}
319
320bool HandleInsertCommand(std::vector<std::string> const& args,
321 cmExecutionStatus& status)
322{
323 if (args.size() < 4) {
324 status.SetError("sub-command INSERT requires at least three arguments.");
325 return false;
326 }
327
328 std::string const& listName = args[1];
329
330 // expand the variable
331 int index;
332 if (!GetIndexArg(args[2], &index, status.GetMakefile())) {
333 status.SetError(cmStrCat("index: ", args[2], " is not a valid index"));
334 return false;
335 }
336 auto list = GetList(listName, status.GetMakefile());
337 if (!list) {
338 list = cmList{};
339 }
340
341 try {
342 list->insert_items(index, args.begin() + 3, args.end(),
343 cmList::ExpandElements::No, cmList::EmptyElements::Yes);
344 status.GetMakefile().AddDefinition(listName, list->to_string());
345 return true;
346 } catch (std::out_of_range& e) {
347 status.SetError(e.what());
348 return false;
349 }
350}
351
352bool HandleJoinCommand(std::vector<std::string> const& args,
353 cmExecutionStatus& status)

Callers

nothing calls this directly

Calls 11

GetIndexArgFunction · 0.85
to_stringMethod · 0.80
cmStrCatFunction · 0.70
GetListFunction · 0.70
sizeMethod · 0.45
SetErrorMethod · 0.45
GetMakefileMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
AddDefinitionMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…