MCPcopy Create free account
hub / github.com/Kitware/CMake / StoreFindResult

Method StoreFindResult

Source/cmFindBase.cxx:605–656  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

603}
604
605void 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
658cmFindBaseDebugState::cmFindBaseDebugState(cmFindBase const* findBase)
659 : cmFindCommonDebugState(findBase->FindCommandName, findBase)

Callers 3

InitialPassMethod · 0.80
InitialPassMethod · 0.80
InitialPassMethod · 0.80

Calls 9

IsNormalDefinitionSetMethod · 0.80
FoundAtMethod · 0.80
cmStrCatFunction · 0.70
cmJoinFunction · 0.70
GetPolicyStatusMethod · 0.45
emptyMethod · 0.45
AddCacheDefinitionMethod · 0.45
AddDefinitionMethod · 0.45
IssueMessageMethod · 0.45

Tested by

no test coverage detected