| 63 | }; |
| 64 | |
| 65 | bool 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 | |
| 119 | bool cmCMakeLanguageCommandDEFER(Defer const& defer, |
| 120 | std::vector<std::string> const& args, |
no test coverage detected
searching dependent graphs…