| 587 | } |
| 588 | |
| 589 | bool 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], ×)) { |
| 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 | |
| 626 | bool HandleRandomCommand(std::vector<std::string> const& args, |
| 627 | cmExecutionStatus& status) |
nothing calls this directly
no test coverage detected
searching dependent graphs…