| 249 | } |
| 250 | |
| 251 | bool cmFindBase::Validate(std::string const& path) const |
| 252 | { |
| 253 | if (this->ValidatorName.empty()) { |
| 254 | return true; |
| 255 | } |
| 256 | |
| 257 | // The validator command will be executed in an isolated scope. |
| 258 | cmMakefile::ScopePushPop varScope(this->Makefile); |
| 259 | cmMakefile::PolicyPushPop polScope(this->Makefile); |
| 260 | static_cast<void>(varScope); |
| 261 | static_cast<void>(polScope); |
| 262 | |
| 263 | auto resultName = |
| 264 | cmStrCat("CMAKE_"_s, cmSystemTools::UpperCase(this->FindCommandName), |
| 265 | "_VALIDATOR_STATUS"_s); |
| 266 | |
| 267 | this->Makefile->AddDefinitionBool(resultName, true); |
| 268 | |
| 269 | cmListFileFunction validator( |
| 270 | this->ValidatorName, 0, 0, |
| 271 | { cmListFileArgument(resultName, cmListFileArgument::Unquoted, 0), |
| 272 | cmListFileArgument(path, cmListFileArgument::Quoted, 0) }); |
| 273 | cmExecutionStatus status(*this->Makefile); |
| 274 | |
| 275 | if (this->Makefile->ExecuteCommand(validator, status)) { |
| 276 | return this->Makefile->GetDefinition(resultName).IsOn(); |
| 277 | } |
| 278 | return false; |
| 279 | } |
| 280 | |
| 281 | void cmFindBase::ExpandPaths() |
| 282 | { |
no test coverage detected