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

Function HandleRepeatCommand

Source/cmStringCommand.cxx:589–624  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

587}
588
589bool HandleRepeatCommand(std::vector<std::string> const& args,
590 cmExecutionStatus& status)
591{
592 cmMakefile& makefile = status.GetMakefile();
593
594 // `string(REPEAT "<str>" <times> OUTPUT_VARIABLE)`
595 enum ArgPos : std::size_t
596 {
597 SUB_COMMAND,
598 VALUE,
599 TIMES,
600 OUTPUT_VARIABLE,
601 TOTAL_ARGS
602 };
603
604 if (args.size() != ArgPos::TOTAL_ARGS) {
605 makefile.IssueMessage(MessageType::FATAL_ERROR,
606 "sub-command REPEAT requires three arguments.");
607 return true;
608 }
609
610 unsigned long times;
611 if (!cmStrToULong(args[ArgPos::TIMES], &times)) {
612 makefile.IssueMessage(MessageType::FATAL_ERROR,
613 "repeat count is not a positive number.");
614 return true;
615 }
616
617 cm::CMakeString data{ args[ArgPos::VALUE] };
618 data.Repeat(times);
619
620 auto const& variableName = args[ArgPos::OUTPUT_VARIABLE];
621
622 makefile.AddDefinition(variableName, data);
623 return true;
624}
625
626bool HandleRandomCommand(std::vector<std::string> const& args,
627 cmExecutionStatus& status)

Callers

nothing calls this directly

Calls 5

cmStrToULongFunction · 0.85
GetMakefileMethod · 0.45
sizeMethod · 0.45
IssueMessageMethod · 0.45
AddDefinitionMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…