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

Method GetInitialState

Source/cmFindBase.cxx:484–515  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

482}
483
484cmFindBase::FindState cmFindBase::GetInitialState()
485{
486 if (cmValue value = this->Makefile->GetDefinition(this->VariableName)) {
487 cmState* state = this->Makefile->GetState();
488 cmValue cacheEntry = state->GetCacheEntryValue(this->VariableName);
489 bool found = !cmIsNOTFOUND(*value);
490 bool cached = cacheEntry != nullptr;
491 auto cacheType = cached ? state->GetCacheEntryType(this->VariableName)
492 : cmStateEnums::UNINITIALIZED;
493
494 if (cached && cacheType != cmStateEnums::UNINITIALIZED) {
495 this->VariableType = cacheType;
496 if (auto const& hs =
497 state->GetCacheEntryProperty(this->VariableName, "HELPSTRING")) {
498 this->VariableDocumentation = *hs;
499 }
500 }
501
502 if (found) {
503 // If the user specifies the entry on the command line without a
504 // type we should add the type and docstring but keep the
505 // original value. Tell the subclass implementations to do
506 // this.
507 if (cached && cacheType == cmStateEnums::UNINITIALIZED) {
508 this->AlreadyInCacheWithoutMetaInfo = true;
509 }
510 return FindState::Found;
511 }
512 return FindState::NotFound;
513 }
514 return FindState::Undefined;
515}
516
517bool cmFindBase::IsFound() const
518{

Callers 1

ParseArgumentsMethod · 0.95

Calls 6

cmIsNOTFOUNDFunction · 0.85
GetDefinitionMethod · 0.45
GetStateMethod · 0.45
GetCacheEntryValueMethod · 0.45
GetCacheEntryTypeMethod · 0.45
GetCacheEntryPropertyMethod · 0.45

Tested by

no test coverage detected