| 603 | } |
| 604 | |
| 605 | void cmFindBase::StoreFindResult(std::string const& value) |
| 606 | { |
| 607 | bool force = |
| 608 | this->Makefile->GetPolicyStatus(cmPolicies::CMP0125) == cmPolicies::NEW; |
| 609 | bool updateNormalVariable = |
| 610 | this->Makefile->GetPolicyStatus(cmPolicies::CMP0126) == cmPolicies::NEW; |
| 611 | |
| 612 | if (!value.empty()) { |
| 613 | if (this->StoreResultInCache) { |
| 614 | this->Makefile->AddCacheDefinition(this->VariableName, value, |
| 615 | this->VariableDocumentation, |
| 616 | this->VariableType, force); |
| 617 | if (updateNormalVariable && |
| 618 | this->Makefile->IsNormalDefinitionSet(this->VariableName)) { |
| 619 | this->Makefile->AddDefinition(this->VariableName, value); |
| 620 | } |
| 621 | } else { |
| 622 | this->Makefile->AddDefinition(this->VariableName, value); |
| 623 | } |
| 624 | |
| 625 | if (this->DebugState) { |
| 626 | this->DebugState->FoundAt(value); |
| 627 | } |
| 628 | |
| 629 | return; |
| 630 | } |
| 631 | |
| 632 | auto notFound = cmStrCat(this->VariableName, "-NOTFOUND"); |
| 633 | if (this->StoreResultInCache) { |
| 634 | this->Makefile->AddCacheDefinition(this->VariableName, notFound, |
| 635 | this->VariableDocumentation, |
| 636 | this->VariableType, force); |
| 637 | if (updateNormalVariable && |
| 638 | this->Makefile->IsNormalDefinitionSet(this->VariableName)) { |
| 639 | this->Makefile->AddDefinition(this->VariableName, notFound); |
| 640 | } |
| 641 | } else { |
| 642 | this->Makefile->AddDefinition(this->VariableName, notFound); |
| 643 | } |
| 644 | |
| 645 | if (this->Required) { |
| 646 | this->Makefile->IssueMessage( |
| 647 | MessageType::FATAL_ERROR, |
| 648 | cmStrCat("Could not find ", this->VariableName, " using the following ", |
| 649 | (this->FindCommandName == "find_file" || |
| 650 | this->FindCommandName == "find_path" |
| 651 | ? "files" |
| 652 | : "names"), |
| 653 | ": ", cmJoin(this->Names, ", "))); |
| 654 | cmSystemTools::SetFatalErrorOccurred(); |
| 655 | } |
| 656 | } |
| 657 | |
| 658 | cmFindBaseDebugState::cmFindBaseDebugState(cmFindBase const* findBase) |
| 659 | : cmFindCommonDebugState(findBase->FindCommandName, findBase) |
no test coverage detected