=========================================================================
| 178 | |
| 179 | //========================================================================= |
| 180 | bool cmIfCommand(std::vector<cmListFileArgument> const& args, |
| 181 | cmExecutionStatus& inStatus) |
| 182 | { |
| 183 | cmMakefile& makefile = inStatus.GetMakefile(); |
| 184 | std::string errorString; |
| 185 | |
| 186 | std::vector<cmExpandedCommandArgument> expandedArguments; |
| 187 | makefile.ExpandArguments(args, expandedArguments); |
| 188 | |
| 189 | MessageType status; |
| 190 | |
| 191 | cmConditionEvaluator conditionEvaluator(makefile, makefile.GetBacktrace()); |
| 192 | |
| 193 | bool isTrue = |
| 194 | conditionEvaluator.IsTrue(expandedArguments, errorString, status); |
| 195 | |
| 196 | if (!errorString.empty()) { |
| 197 | std::string err = |
| 198 | cmStrCat("if ", cmIfCommandError(expandedArguments), errorString); |
| 199 | if (status == MessageType::FATAL_ERROR) { |
| 200 | makefile.IssueMessage(MessageType::FATAL_ERROR, err); |
| 201 | cmSystemTools::SetFatalErrorOccurred(); |
| 202 | return true; |
| 203 | } |
| 204 | makefile.IssueMessage(status, err); |
| 205 | } |
| 206 | |
| 207 | { |
| 208 | auto fb = cm::make_unique<cmIfFunctionBlocker>(); |
| 209 | // if is isn't true block the commands |
| 210 | fb->IsBlocking = !isTrue; |
| 211 | if (isTrue) { |
| 212 | fb->HasRun = true; |
| 213 | } |
| 214 | fb->Args = args; |
| 215 | makefile.AddFunctionBlocker(std::move(fb)); |
| 216 | } |
| 217 | |
| 218 | return true; |
| 219 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…