cmState::GetInitializedCacheValue: return cmProp
cmProp alias is used; no actual change in type
This commit is contained in:
parent
c09efe074d
commit
e267c3fddf
@ -69,8 +69,7 @@ const char* cmCommandArgumentParserHelper::ExpandSpecialVariable(
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
if (strcmp(key, "CACHE") == 0) {
|
if (strcmp(key, "CACHE") == 0) {
|
||||||
if (const std::string* c =
|
if (cmProp c = this->Makefile->GetState()->GetInitializedCacheValue(var)) {
|
||||||
this->Makefile->GetState()->GetInitializedCacheValue(var)) {
|
|
||||||
if (this->EscapeQuotes) {
|
if (this->EscapeQuotes) {
|
||||||
return this->AddString(cmEscapeQuotes(*c));
|
return this->AddString(cmEscapeQuotes(*c));
|
||||||
}
|
}
|
||||||
|
@ -243,8 +243,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out,
|
|||||||
const bool envVarSet = cmSystemTools::GetEnv(envVar, envVarValue);
|
const bool envVarSet = cmSystemTools::GetEnv(envVar, envVarValue);
|
||||||
|
|
||||||
std::string cacheEntryName = cmStrCat("CMAKE_ECLIPSE_ENVVAR_", envVar);
|
std::string cacheEntryName = cmStrCat("CMAKE_ECLIPSE_ENVVAR_", envVar);
|
||||||
const std::string* cacheValue =
|
cmProp cacheValue = lg.GetState()->GetInitializedCacheValue(cacheEntryName);
|
||||||
lg.GetState()->GetInitializedCacheValue(cacheEntryName);
|
|
||||||
|
|
||||||
// now we have both, decide which one to use
|
// now we have both, decide which one to use
|
||||||
std::string valueToUse;
|
std::string valueToUse;
|
||||||
|
@ -232,7 +232,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string& lang,
|
|||||||
if (!optional && (path.empty() || !cmSystemTools::FileExists(path))) {
|
if (!optional && (path.empty() || !cmSystemTools::FileExists(path))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const std::string* cname =
|
cmProp cname =
|
||||||
this->GetCMakeInstance()->GetState()->GetInitializedCacheValue(langComp);
|
this->GetCMakeInstance()->GetState()->GetInitializedCacheValue(langComp);
|
||||||
std::string changeVars;
|
std::string changeVars;
|
||||||
if (cname && !optional) {
|
if (cname && !optional) {
|
||||||
@ -2057,8 +2057,7 @@ void cmGlobalGenerator::AddMakefile(std::unique_ptr<cmMakefile> mf)
|
|||||||
|
|
||||||
// update progress
|
// update progress
|
||||||
// estimate how many lg there will be
|
// estimate how many lg there will be
|
||||||
const std::string* numGenC =
|
cmProp numGenC = this->CMakeInstance->GetState()->GetInitializedCacheValue(
|
||||||
this->CMakeInstance->GetState()->GetInitializedCacheValue(
|
|
||||||
"CMAKE_NUMBER_OF_MAKEFILES");
|
"CMAKE_NUMBER_OF_MAKEFILES");
|
||||||
|
|
||||||
if (!numGenC) {
|
if (!numGenC) {
|
||||||
|
@ -1880,8 +1880,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
|
|||||||
cmStateEnums::CacheEntryType type,
|
cmStateEnums::CacheEntryType type,
|
||||||
bool force)
|
bool force)
|
||||||
{
|
{
|
||||||
const std::string* existingValue =
|
cmProp existingValue = this->GetState()->GetInitializedCacheValue(name);
|
||||||
this->GetState()->GetInitializedCacheValue(name);
|
|
||||||
// must be outside the following if() to keep it alive long enough
|
// must be outside the following if() to keep it alive long enough
|
||||||
std::string nvalue;
|
std::string nvalue;
|
||||||
|
|
||||||
@ -2682,7 +2681,7 @@ const std::string& cmMakefile::GetRequiredDefinition(
|
|||||||
|
|
||||||
bool cmMakefile::IsDefinitionSet(const std::string& name) const
|
bool cmMakefile::IsDefinitionSet(const std::string& name) const
|
||||||
{
|
{
|
||||||
const std::string* def = this->StateSnapshot.GetDefinition(name);
|
cmProp def = this->StateSnapshot.GetDefinition(name);
|
||||||
if (!def) {
|
if (!def) {
|
||||||
def = this->GetState()->GetInitializedCacheValue(name);
|
def = this->GetState()->GetInitializedCacheValue(name);
|
||||||
}
|
}
|
||||||
@ -2699,7 +2698,7 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const
|
|||||||
|
|
||||||
const std::string* cmMakefile::GetDef(const std::string& name) const
|
const std::string* cmMakefile::GetDef(const std::string& name) const
|
||||||
{
|
{
|
||||||
const std::string* def = this->StateSnapshot.GetDefinition(name);
|
cmProp def = this->StateSnapshot.GetDefinition(name);
|
||||||
if (!def) {
|
if (!def) {
|
||||||
def = this->GetState()->GetInitializedCacheValue(name);
|
def = this->GetState()->GetInitializedCacheValue(name);
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
#include "cmake.h"
|
#include "cmake.h"
|
||||||
|
|
||||||
|
using cmProp = const std::string*; // just to silence IWYU
|
||||||
|
|
||||||
// Get rid of some windows macros:
|
// Get rid of some windows macros:
|
||||||
#undef max
|
#undef max
|
||||||
|
|
||||||
@ -562,7 +564,7 @@ cmServerResponse cmServerProtocol1::ProcessConfigure(
|
|||||||
|
|
||||||
if (cm->LoadCache(buildDir)) {
|
if (cm->LoadCache(buildDir)) {
|
||||||
// build directory has been set up before
|
// build directory has been set up before
|
||||||
const std::string* cachedSourceDir =
|
cmProp cachedSourceDir =
|
||||||
cm->GetState()->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY");
|
cm->GetState()->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY");
|
||||||
if (!cachedSourceDir) {
|
if (!cachedSourceDir) {
|
||||||
return request.ReportError("No CMAKE_HOME_DIRECTORY found in cache.");
|
return request.ReportError("No CMAKE_HOME_DIRECTORY found in cache.");
|
||||||
@ -572,7 +574,7 @@ cmServerResponse cmServerProtocol1::ProcessConfigure(
|
|||||||
cm->SetHomeDirectory(sourceDir);
|
cm->SetHomeDirectory(sourceDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string* cachedGenerator =
|
cmProp cachedGenerator =
|
||||||
cm->GetState()->GetInitializedCacheValue("CMAKE_GENERATOR");
|
cm->GetState()->GetInitializedCacheValue("CMAKE_GENERATOR");
|
||||||
if (cachedGenerator) {
|
if (cachedGenerator) {
|
||||||
if (gg && gg->GetName() != *cachedGenerator) {
|
if (gg && gg->GetName() != *cachedGenerator) {
|
||||||
|
@ -155,8 +155,7 @@ std::string cmState::GetSafeCacheEntryValue(std::string const& key) const
|
|||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string* cmState::GetInitializedCacheValue(
|
cmProp cmState::GetInitializedCacheValue(std::string const& key) const
|
||||||
std::string const& key) const
|
|
||||||
{
|
{
|
||||||
return this->CacheManager->GetInitializedCacheValue(key);
|
return this->CacheManager->GetInitializedCacheValue(key);
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ public:
|
|||||||
std::vector<std::string> GetCacheEntryKeys() const;
|
std::vector<std::string> GetCacheEntryKeys() const;
|
||||||
cmProp GetCacheEntryValue(std::string const& key) const;
|
cmProp GetCacheEntryValue(std::string const& key) const;
|
||||||
std::string GetSafeCacheEntryValue(std::string const& key) const;
|
std::string GetSafeCacheEntryValue(std::string const& key) const;
|
||||||
const std::string* GetInitializedCacheValue(std::string const& key) const;
|
cmProp GetInitializedCacheValue(std::string const& key) const;
|
||||||
cmStateEnums::CacheEntryType GetCacheEntryType(std::string const& key) const;
|
cmStateEnums::CacheEntryType GetCacheEntryType(std::string const& key) const;
|
||||||
void SetCacheEntryValue(std::string const& key, std::string const& value);
|
void SetCacheEntryValue(std::string const& key, std::string const& value);
|
||||||
void SetCacheValue(std::string const& key, std::string const& value);
|
void SetCacheValue(std::string const& key, std::string const& value);
|
||||||
|
@ -313,8 +313,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
|
|||||||
bool haveValue = false;
|
bool haveValue = false;
|
||||||
std::string cachedValue;
|
std::string cachedValue;
|
||||||
if (this->WarnUnusedCli) {
|
if (this->WarnUnusedCli) {
|
||||||
if (const std::string* v =
|
if (cmProp v = this->State->GetInitializedCacheValue(var)) {
|
||||||
this->State->GetInitializedCacheValue(var)) {
|
|
||||||
haveValue = true;
|
haveValue = true;
|
||||||
cachedValue = *v;
|
cachedValue = *v;
|
||||||
}
|
}
|
||||||
@ -1529,9 +1528,8 @@ int cmake::ActualConfigure()
|
|||||||
|
|
||||||
// no generator specified on the command line
|
// no generator specified on the command line
|
||||||
if (!this->GlobalGenerator) {
|
if (!this->GlobalGenerator) {
|
||||||
const std::string* genName =
|
cmProp genName = this->State->GetInitializedCacheValue("CMAKE_GENERATOR");
|
||||||
this->State->GetInitializedCacheValue("CMAKE_GENERATOR");
|
cmProp extraGenName =
|
||||||
const std::string* extraGenName =
|
|
||||||
this->State->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
|
this->State->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
|
||||||
if (genName) {
|
if (genName) {
|
||||||
std::string fullName =
|
std::string fullName =
|
||||||
@ -1554,8 +1552,7 @@ int cmake::ActualConfigure()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string* genName =
|
cmProp genName = this->State->GetInitializedCacheValue("CMAKE_GENERATOR");
|
||||||
this->State->GetInitializedCacheValue("CMAKE_GENERATOR");
|
|
||||||
if (genName) {
|
if (genName) {
|
||||||
if (!this->GlobalGenerator->MatchesGeneratorName(*genName)) {
|
if (!this->GlobalGenerator->MatchesGeneratorName(*genName)) {
|
||||||
std::string message =
|
std::string message =
|
||||||
@ -1577,7 +1574,7 @@ int cmake::ActualConfigure()
|
|||||||
cmStateEnums::INTERNAL);
|
cmStateEnums::INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (const std::string* instance =
|
if (cmProp instance =
|
||||||
this->State->GetInitializedCacheValue("CMAKE_GENERATOR_INSTANCE")) {
|
this->State->GetInitializedCacheValue("CMAKE_GENERATOR_INSTANCE")) {
|
||||||
if (this->GeneratorInstanceSet && this->GeneratorInstance != *instance) {
|
if (this->GeneratorInstanceSet && this->GeneratorInstance != *instance) {
|
||||||
std::string message =
|
std::string message =
|
||||||
@ -1594,7 +1591,7 @@ int cmake::ActualConfigure()
|
|||||||
"Generator instance identifier.", cmStateEnums::INTERNAL);
|
"Generator instance identifier.", cmStateEnums::INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (const std::string* platformName =
|
if (cmProp platformName =
|
||||||
this->State->GetInitializedCacheValue("CMAKE_GENERATOR_PLATFORM")) {
|
this->State->GetInitializedCacheValue("CMAKE_GENERATOR_PLATFORM")) {
|
||||||
if (this->GeneratorPlatformSet &&
|
if (this->GeneratorPlatformSet &&
|
||||||
this->GeneratorPlatform != *platformName) {
|
this->GeneratorPlatform != *platformName) {
|
||||||
@ -1612,7 +1609,7 @@ int cmake::ActualConfigure()
|
|||||||
"Name of generator platform.", cmStateEnums::INTERNAL);
|
"Name of generator platform.", cmStateEnums::INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (const std::string* tsName =
|
if (cmProp tsName =
|
||||||
this->State->GetInitializedCacheValue("CMAKE_GENERATOR_TOOLSET")) {
|
this->State->GetInitializedCacheValue("CMAKE_GENERATOR_TOOLSET")) {
|
||||||
if (this->GeneratorToolsetSet && this->GeneratorToolset != *tsName) {
|
if (this->GeneratorToolsetSet && this->GeneratorToolset != *tsName) {
|
||||||
std::string message =
|
std::string message =
|
||||||
@ -1983,7 +1980,7 @@ std::string cmake::StripExtension(const std::string& file) const
|
|||||||
|
|
||||||
const char* cmake::GetCacheDefinition(const std::string& name) const
|
const char* cmake::GetCacheDefinition(const std::string& name) const
|
||||||
{
|
{
|
||||||
const std::string* p = this->State->GetInitializedCacheValue(name);
|
cmProp p = this->State->GetInitializedCacheValue(name);
|
||||||
return p ? p->c_str() : nullptr;
|
return p ? p->c_str() : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2190,7 +2187,7 @@ void cmake::PrintGeneratorList()
|
|||||||
void cmake::UpdateConversionPathTable()
|
void cmake::UpdateConversionPathTable()
|
||||||
{
|
{
|
||||||
// Update the path conversion table with any specified file:
|
// Update the path conversion table with any specified file:
|
||||||
const std::string* tablepath =
|
cmProp tablepath =
|
||||||
this->State->GetInitializedCacheValue("CMAKE_PATH_TRANSLATION_FILE");
|
this->State->GetInitializedCacheValue("CMAKE_PATH_TRANSLATION_FILE");
|
||||||
|
|
||||||
if (tablepath) {
|
if (tablepath) {
|
||||||
@ -2834,7 +2831,7 @@ bool cmake::Open(const std::string& dir, bool dryRun)
|
|||||||
std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n";
|
std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const std::string* extraGenName =
|
cmProp extraGenName =
|
||||||
this->State->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
|
this->State->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
|
||||||
std::string fullName =
|
std::string fullName =
|
||||||
cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
|
cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
|
||||||
|
Loading…
Reference in New Issue
Block a user