summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/QtDialog/QCMake.cxx3
-rw-r--r--Source/cmCacheManager.cxx16
-rw-r--r--Source/cmCacheManager.h2
-rw-r--r--Source/cmCommandArgumentParserHelper.cxx3
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx2
-rw-r--r--Source/cmGlobalGenerator.cxx6
-rw-r--r--Source/cmMakefile.cxx9
-rw-r--r--Source/cmake.cxx47
8 files changed, 51 insertions, 37 deletions
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index 3df48d1..009d06e 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -117,7 +117,8 @@ void QCMake::setBinaryDirectory(const QString& _dir)
}
if ( itm.Find("CMAKE_GENERATOR"))
{
- const char* extraGen = cachem->GetCacheValue("CMAKE_EXTRA_GENERATOR");
+ const char* extraGen = cachem
+ ->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
std::string curGen = cmExternalMakefileProjectGenerator::
CreateFullGeneratorName(itm.GetValue(), extraGen? extraGen : "");
this->setGenerator(QString::fromLocal8Bit(curGen.c_str()));
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index b8dfe04..5387d0c 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -283,14 +283,16 @@ bool cmCacheManager::LoadCache(const std::string& path,
}
this->CacheMajorVersion = 0;
this->CacheMinorVersion = 0;
- if(const char* cmajor = this->GetCacheValue("CMAKE_CACHE_MAJOR_VERSION"))
+ if(const char* cmajor =
+ this->GetInitializedCacheValue("CMAKE_CACHE_MAJOR_VERSION"))
{
unsigned int v=0;
if(sscanf(cmajor, "%u", &v) == 1)
{
this->CacheMajorVersion = v;
}
- if(const char* cminor = this->GetCacheValue("CMAKE_CACHE_MINOR_VERSION"))
+ if(const char* cminor =
+ this->GetInitializedCacheValue("CMAKE_CACHE_MINOR_VERSION"))
{
if(sscanf(cminor, "%u", &v) == 1)
{
@@ -312,10 +314,11 @@ bool cmCacheManager::LoadCache(const std::string& path,
}
// check to make sure the cache directory has not
// been moved
- if ( internal && this->GetCacheValue("CMAKE_CACHEFILE_DIR") )
+ const char* oldDir = this->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR");
+ if (internal && oldDir)
{
std::string currentcwd = path;
- std::string oldcwd = this->GetCacheValue("CMAKE_CACHEFILE_DIR");
+ std::string oldcwd = oldDir;
cmSystemTools::ConvertToUnixSlashes(currentcwd);
currentcwd += "/CMakeCache.txt";
oldcwd += "/CMakeCache.txt";
@@ -324,7 +327,7 @@ bool cmCacheManager::LoadCache(const std::string& path,
std::string message =
std::string("The current CMakeCache.txt directory ") +
currentcwd + std::string(" is different than the directory ") +
- std::string(this->GetCacheValue("CMAKE_CACHEFILE_DIR")) +
+ std::string(this->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR")) +
std::string(" where CMakeCache.txt was created. This may result "
"in binaries being created in the wrong place. If you "
"are not sure, reedit the CMakeCache.txt");
@@ -654,7 +657,8 @@ cmCacheManager::CacheIterator cmCacheManager::GetCacheIterator(
return CacheIterator(*this, key);
}
-const char* cmCacheManager::GetCacheValue(const std::string& key) const
+const char*
+cmCacheManager::GetInitializedCacheValue(const std::string& key) const
{
CacheEntryMap::const_iterator i = this->Cache.find(key);
if(i != this->Cache.end() &&
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index f7f8776..31d302a 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -137,7 +137,7 @@ public:
CacheEntryType& type);
///! Get a value from the cache given a key
- const char* GetCacheValue(const std::string& key) const;
+ const char* GetInitializedCacheValue(const std::string& key) const;
/** Get the version of CMake that wrote the cache. */
unsigned int GetCacheMajorVersion() const
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index 747b7e4..99bf5f5 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -90,7 +90,8 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key,
}
if ( strcmp(key, "CACHE") == 0 )
{
- if(const char* c = this->Makefile->GetCacheManager()->GetCacheValue(var))
+ if(const char* c = this->Makefile->GetCacheManager()
+ ->GetInitializedCacheValue(var))
{
if(this->EscapeQuotes)
{
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 810ec57..0d32e4b 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -205,7 +205,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
std::string cacheEntryName = "CMAKE_ECLIPSE_ENVVAR_";
cacheEntryName += envVar;
- const char* cacheValue = mf->GetCacheManager()->GetCacheValue(
+ const char* cacheValue = mf->GetCacheManager()->GetInitializedCacheValue(
cacheEntryName);
// now we have both, decide which one to use
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 3c0a0e2..f23caa6 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -179,7 +179,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang,
return;
}
const char* cname = this->GetCMakeInstance()->
- GetCacheManager()->GetCacheValue(langComp);
+ GetCacheManager()->GetInitializedCacheValue(langComp);
std::string changeVars;
if(cname && !optional)
{
@@ -1641,7 +1641,7 @@ int cmGlobalGenerator::TryCompile(const std::string& srcdir,
// and there is a good chance that the try compile stuff will
// take the bulk of the time, so try and guess some progress
// by getting closer and closer to 100 without actually getting there.
- if (!this->CMakeInstance->GetCacheManager()->GetCacheValue
+ if (!this->CMakeInstance->GetCacheManager()->GetInitializedCacheValue
("CMAKE_NUMBER_OF_LOCAL_GENERATORS"))
{
// If CMAKE_NUMBER_OF_LOCAL_GENERATORS is not set
@@ -1839,7 +1839,7 @@ void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg)
// update progress
// estimate how many lg there will be
const char *numGenC =
- this->CMakeInstance->GetCacheManager()->GetCacheValue
+ this->CMakeInstance->GetCacheManager()->GetInitializedCacheValue
("CMAKE_NUMBER_OF_LOCAL_GENERATORS");
if (!numGenC)
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index ad4ad7c..b6eff3d 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2432,7 +2432,7 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const
this->Internal->VarUsageStack.top().insert(name);
if(!def)
{
- def = this->GetCacheManager()->GetCacheValue(name);
+ def = this->GetCacheManager()->GetInitializedCacheValue(name);
}
#ifdef CMAKE_BUILD_WITH_CMAKE
if(cmVariableWatch* vv = this->GetVariableWatch())
@@ -2457,7 +2457,7 @@ const char* cmMakefile::GetDefinition(const std::string& name) const
const char* def = this->Internal->VarStack.top().Get(name);
if(!def)
{
- def = this->GetCacheManager()->GetCacheValue(name);
+ def = this->GetCacheManager()->GetInitializedCacheValue(name);
}
#ifdef CMAKE_BUILD_WITH_CMAKE
cmVariableWatch* vv = this->GetVariableWatch();
@@ -2835,7 +2835,8 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
value = cmSystemTools::GetEnv(lookup.c_str());
break;
case CACHE:
- value = this->GetCacheManager()->GetCacheValue(lookup);
+ value = this->GetCacheManager()
+ ->GetInitializedCacheValue(lookup);
break;
}
// Get the string we're meant to append to.
@@ -4903,7 +4904,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
(status == cmPolicies::WARN || status == cmPolicies::OLD))
{
if(!(this->GetCacheManager()
- ->GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")))
+ ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")))
{
// Set it to 2.4 because that is the last version where the
// variable had meaning.
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index e781417..210c0ef 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -344,7 +344,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
std::string cachedValue;
if(this->WarnUnusedCli)
{
- if(const char *v = this->CacheManager->GetCacheValue(var))
+ if(const char *v = this->CacheManager
+ ->GetInitializedCacheValue(var))
{
haveValue = true;
cachedValue = v;
@@ -357,7 +358,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
if(this->WarnUnusedCli)
{
if (!haveValue ||
- cachedValue != this->CacheManager->GetCacheValue(var))
+ cachedValue != this->CacheManager
+ ->GetInitializedCacheValue(var))
{
this->WatchUnusedCli(var);
}
@@ -1203,10 +1205,10 @@ int cmake::DoPreConfigureChecks()
}
// do a sanity check on some values
- if(this->CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY"))
+ if(this->CacheManager->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY"))
{
std::string cacheStart =
- this->CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY");
+ this->CacheManager->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY");
cacheStart += "/CMakeLists.txt";
std::string currentStart = this->GetHomeDirectory();
currentStart += "/CMakeLists.txt";
@@ -1355,9 +1357,9 @@ int cmake::ActualConfigure()
if(!this->GlobalGenerator)
{
const char* genName =
- this->CacheManager->GetCacheValue("CMAKE_GENERATOR");
+ this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR");
const char* extraGenName =
- this->CacheManager->GetCacheValue("CMAKE_EXTRA_GENERATOR");
+ this->CacheManager->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
if(genName)
{
std::string fullName = cmExternalMakefileProjectGenerator::
@@ -1435,7 +1437,8 @@ int cmake::ActualConfigure()
}
}
- const char* genName = this->CacheManager->GetCacheValue("CMAKE_GENERATOR");
+ const char* genName = this->CacheManager
+ ->GetInitializedCacheValue("CMAKE_GENERATOR");
if(genName)
{
if(!this->GlobalGenerator->MatchesGeneratorName(genName))
@@ -1451,7 +1454,7 @@ int cmake::ActualConfigure()
return -2;
}
}
- if(!this->CacheManager->GetCacheValue("CMAKE_GENERATOR"))
+ if(!this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR"))
{
this->CacheManager->AddCacheEntry("CMAKE_GENERATOR",
this->GlobalGenerator->GetName().c_str(),
@@ -1464,7 +1467,7 @@ int cmake::ActualConfigure()
}
if(const char* platformName =
- this->CacheManager->GetCacheValue("CMAKE_GENERATOR_PLATFORM"))
+ this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR_PLATFORM"))
{
if(this->GeneratorPlatform.empty())
{
@@ -1492,7 +1495,7 @@ int cmake::ActualConfigure()
}
if(const char* tsName =
- this->CacheManager->GetCacheValue("CMAKE_GENERATOR_TOOLSET"))
+ this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR_TOOLSET"))
{
if(this->GeneratorToolset.empty())
{
@@ -1546,16 +1549,18 @@ int cmake::ActualConfigure()
// project requires compatibility with CMake 2.4. We detect this
// here by looking for the old CMAKE_BACKWARDS_COMPATIBILITY
// variable created when CMP0001 is not set to NEW.
- if(this->GetCacheManager()->GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))
+ if(this->GetCacheManager()
+ ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))
{
- if(!this->CacheManager->GetCacheValue("LIBRARY_OUTPUT_PATH"))
+ if(!this->CacheManager->GetInitializedCacheValue("LIBRARY_OUTPUT_PATH"))
{
this->CacheManager->AddCacheEntry
("LIBRARY_OUTPUT_PATH", "",
"Single output directory for building all libraries.",
cmCacheManager::PATH);
}
- if(!this->CacheManager->GetCacheValue("EXECUTABLE_OUTPUT_PATH"))
+ if(!this->CacheManager
+ ->GetInitializedCacheValue("EXECUTABLE_OUTPUT_PATH"))
{
this->CacheManager->AddCacheEntry
("EXECUTABLE_OUTPUT_PATH", "",
@@ -1563,7 +1568,8 @@ int cmake::ActualConfigure()
cmCacheManager::PATH);
}
}
- if(!this->CacheManager->GetCacheValue("CMAKE_USE_RELATIVE_PATHS"))
+ if(!this->CacheManager
+ ->GetInitializedCacheValue("CMAKE_USE_RELATIVE_PATHS"))
{
this->CacheManager->AddCacheEntry
("CMAKE_USE_RELATIVE_PATHS", "OFF",
@@ -1578,9 +1584,9 @@ int cmake::ActualConfigure()
}
if(cmSystemTools::GetFatalErrorOccured() &&
- (!this->CacheManager->GetCacheValue("CMAKE_MAKE_PROGRAM") ||
+ (!this->CacheManager->GetInitializedCacheValue("CMAKE_MAKE_PROGRAM") ||
cmSystemTools::IsOff(this->CacheManager->
- GetCacheValue("CMAKE_MAKE_PROGRAM"))))
+ GetInitializedCacheValue("CMAKE_MAKE_PROGRAM"))))
{
// We must have a bad generator selection. Wipe the cache entry so the
// user can select another.
@@ -1796,7 +1802,7 @@ void cmake::AddCacheEntry(const std::string& key, const char* value,
const char* cmake::GetCacheDefinition(const std::string& name) const
{
- return this->CacheManager->GetCacheValue(name);
+ return this->CacheManager->GetInitializedCacheValue(name);
}
void cmake::AddDefaultCommands()
@@ -1956,7 +1962,8 @@ void cmake::UpdateConversionPathTable()
{
// Update the path conversion table with any specified file:
const char* tablepath =
- this->CacheManager->GetCacheValue("CMAKE_PATH_TRANSLATION_FILE");
+ this->CacheManager
+ ->GetInitializedCacheValue("CMAKE_PATH_TRANSLATION_FILE");
if(tablepath)
{
@@ -2190,7 +2197,7 @@ void cmake::TruncateOutputLog(const char* fname)
{
return;
}
- if ( !this->CacheManager->GetCacheValue("CMAKE_CACHEFILE_DIR") )
+ if ( !this->CacheManager->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR") )
{
cmSystemTools::RemoveFile(fullPath);
return;
@@ -2469,7 +2476,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
// we have to find the module directory, so we can copy the files
this->AddCMakePaths();
std::string modulesPath =
- this->CacheManager->GetCacheValue("CMAKE_ROOT");
+ this->CacheManager->GetInitializedCacheValue("CMAKE_ROOT");
modulesPath += "/Modules";
std::string inFile = modulesPath;
inFile += "/SystemInformation.cmake";