Commit ff7169a0 authored by Stephen Kelly's avatar Stephen Kelly Committed by Brad King

Port to cmState.

parent a6b1ad13
......@@ -9,7 +9,6 @@
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#include "../cmCacheManager.h"
#include "../cmSystemTools.h"
#include "../cmake.h"
#include "../cmDocumentation.h"
......
......@@ -19,6 +19,7 @@
#include "cmCursesDummyWidget.h"
#include "../cmSystemTools.h"
#include "../cmake.h"
#include "../cmState.h"
#include <assert.h>
......@@ -50,9 +51,9 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
}
this->Entry = 0;
const char* value = cm->GetCacheManager()->GetCacheEntryValue(key);
const char* value = cm->GetState()->GetCacheEntryValue(key);
assert(value);
switch (cm->GetCacheManager()->GetCacheEntryType(key))
switch (cm->GetState()->GetCacheEntryType(key))
{
case cmCacheManager::BOOL:
this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1);
......@@ -75,7 +76,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
break;
case cmCacheManager::STRING:
{
const char* stringsProp = cm->GetCacheManager()
const char* stringsProp = cm->GetState()
->GetCacheEntryProperty(key, "STRINGS");
if(stringsProp)
{
......
......@@ -9,7 +9,6 @@
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#include "../cmCacheManager.h"
#include "../cmSystemTools.h"
#include "../cmake.h"
#include "../cmVersion.h"
......
......@@ -23,6 +23,7 @@
#include "cmCursesCacheEntryComposite.h"
#include "cmCursesLongMessageForm.h"
#include "cmAlgorithms.h"
#include "cmState.h"
inline int ctrl(int z)
......@@ -107,17 +108,17 @@ void cmCursesMainForm::InitializeUI()
// which contain labels, entries and new entry markers
std::vector<cmCursesCacheEntryComposite*>* newEntries =
new std::vector<cmCursesCacheEntryComposite*>;
newEntries->reserve(this->CMakeInstance->GetCacheManager()->GetSize());
std::vector<std::string> cacheKeys =
this->CMakeInstance->GetState()->GetCacheEntryKeys();
newEntries->reserve(cacheKeys.size());
// Count non-internal and non-static entries
int count=0;
std::vector<std::string> cacheKeys =
this->CMakeInstance->GetCacheManager()->GetCacheEntryKeys();
for(std::vector<std::string>::const_iterator it = cacheKeys.begin();
it != cacheKeys.end(); ++it)
{
cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager()
cmCacheManager::CacheEntryType t = this->CMakeInstance->GetState()
->GetCacheEntryType(*it);
if (t != cmCacheManager::INTERNAL &&
t != cmCacheManager::STATIC &&
......@@ -147,7 +148,7 @@ void cmCursesMainForm::InitializeUI()
it != cacheKeys.end(); ++it)
{
std::string key = *it;
cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager()
cmCacheManager::CacheEntryType t = this->CMakeInstance->GetState()
->GetCacheEntryType(*it);
if (t == cmCacheManager::INTERNAL ||
t == cmCacheManager::STATIC ||
......@@ -171,7 +172,7 @@ void cmCursesMainForm::InitializeUI()
it != cacheKeys.end(); ++it)
{
std::string key = *it;
cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager()
cmCacheManager::CacheEntryType t = this->CMakeInstance->GetState()
->GetCacheEntryType(*it);
if (t == cmCacheManager::INTERNAL ||
t == cmCacheManager::STATIC ||
......@@ -225,10 +226,10 @@ void cmCursesMainForm::RePost()
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{
const char* existingValue =
this->CMakeInstance->GetCacheManager()
this->CMakeInstance->GetState()
->GetCacheEntryValue((*it)->GetValue());
bool advanced =
this->CMakeInstance->GetCacheManager()
this->CMakeInstance->GetState()
->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
if (!existingValue || (!this->AdvancedMode && advanced))
{
......@@ -257,10 +258,10 @@ void cmCursesMainForm::RePost()
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{
const char* existingValue =
this->CMakeInstance->GetCacheManager()
this->CMakeInstance->GetState()
->GetCacheEntryValue((*it)->GetValue());
bool advanced =
this->CMakeInstance->GetCacheManager()
this->CMakeInstance->GetState()
->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
if (!existingValue || (!this->AdvancedMode && advanced))
{
......@@ -329,10 +330,10 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{
const char* existingValue =
this->CMakeInstance->GetCacheManager()
this->CMakeInstance->GetState()
->GetCacheEntryValue((*it)->GetValue());
bool advanced =
this->CMakeInstance->GetCacheManager()
this->CMakeInstance->GetState()
->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
if (!existingValue || (!this->AdvancedMode && advanced))
{
......@@ -352,10 +353,10 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{
const char* existingValue =
this->CMakeInstance->GetCacheManager()
this->CMakeInstance->GetState()
->GetCacheEntryValue((*it)->GetValue());
bool advanced =
this->CMakeInstance->GetCacheManager()
this->CMakeInstance->GetState()
->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
if (!existingValue || (!this->AdvancedMode && advanced))
{
......@@ -516,10 +517,10 @@ void cmCursesMainForm::UpdateStatusBar(const char* message)
// Get the help string of the current entry
// and add it to the help string
const char* existingValue =
this->CMakeInstance->GetCacheManager()->GetCacheEntryValue(curField);
this->CMakeInstance->GetState()->GetCacheEntryValue(curField);
if (existingValue)
{
const char* hs = this->CMakeInstance->GetCacheManager()
const char* hs = this->CMakeInstance->GetState()
->GetCacheEntryProperty(curField, "HELPSTRING");
if ( hs )
{
......@@ -814,7 +815,7 @@ void cmCursesMainForm::FillCacheManagerFromUI()
for(size_t i=0; i < size; i++)
{
std::string cacheKey = (*this->Entries)[i]->Key;
const char* existingValue = this->CMakeInstance->GetCacheManager()
const char* existingValue = this->CMakeInstance->GetState()
->GetCacheEntryValue(cacheKey);
if (existingValue)
{
......@@ -823,7 +824,7 @@ void cmCursesMainForm::FillCacheManagerFromUI()
std::string fixedOldValue;
std::string fixedNewValue;
cmCacheManager::CacheEntryType t =
this->CMakeInstance->GetCacheManager()
this->CMakeInstance->GetState()
->GetCacheEntryType(cacheKey);
this->FixValue(t, oldValue, fixedOldValue);
this->FixValue(t, newValue, fixedNewValue);
......@@ -831,9 +832,9 @@ void cmCursesMainForm::FillCacheManagerFromUI()
if(!(fixedOldValue == fixedNewValue))
{
// The user has changed the value. Mark it as modified.
this->CMakeInstance->GetCacheManager()
this->CMakeInstance->GetState()
->SetCacheEntryBoolProperty(cacheKey, "MODIFIED", true);
this->CMakeInstance->GetCacheManager()
this->CMakeInstance->GetState()
->SetCacheEntryValue(cacheKey, fixedNewValue);
}
}
......@@ -1046,11 +1047,11 @@ void cmCursesMainForm::HandleInput()
const char* helpString = 0;
const char* existingValue =
this->CMakeInstance->GetCacheManager()
this->CMakeInstance->GetState()
->GetCacheEntryValue(curField);
if (existingValue)
{
helpString = this->CMakeInstance->GetCacheManager()
helpString = this->CMakeInstance->GetState()
->GetCacheEntryProperty(curField, "HELPSTRING");
}
if (helpString)
......@@ -1161,7 +1162,7 @@ void cmCursesMainForm::HandleInput()
field_userptr(this->Fields[findex-2]));
if ( lbl )
{
this->CMakeInstance->GetCacheManager()->RemoveCacheEntry(lbl->GetValue());
this->CMakeInstance->GetState()->RemoveCacheEntry(lbl->GetValue());
std::string nextVal;
if (nextCur)
......
......@@ -16,7 +16,7 @@
#include <QCoreApplication>
#include "cmake.h"
#include "cmCacheManager.h"
#include "cmState.h"
#include "cmSystemTools.h"
#include "cmExternalMakefileProjectGenerator.h"
......@@ -94,7 +94,7 @@ void QCMake::setBinaryDirectory(const QString& _dir)
{
this->BinaryDirectory = QDir::fromNativeSeparators(dir);
emit this->binaryDirChanged(this->BinaryDirectory);
cmCacheManager *cachem = this->CMakeInstance->GetCacheManager();
cmState* state = this->CMakeInstance->GetState();
this->setGenerator(QString());
if(!this->CMakeInstance->LoadCache(
this->BinaryDirectory.toLocal8Bit().data()))
......@@ -110,15 +110,15 @@ void QCMake::setBinaryDirectory(const QString& _dir)
QCMakePropertyList props = this->properties();
emit this->propertiesChanged(props);
const char* homeDir = cachem->GetCacheEntryValue("CMAKE_HOME_DIRECTORY");
const char* homeDir = state->GetCacheEntryValue("CMAKE_HOME_DIRECTORY");
if (homeDir)
{
setSourceDirectory(QString::fromLocal8Bit(homeDir));
}
const char* gen = cachem->GetCacheEntryValue("CMAKE_GENERATOR");
const char* gen = state->GetCacheEntryValue("CMAKE_GENERATOR");
if (gen)
{
const char* extraGen = cachem
const char* extraGen = state
->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
std::string curGen = cmExternalMakefileProjectGenerator::
CreateFullGeneratorName(gen, extraGen? extraGen : "");
......@@ -195,12 +195,12 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
QStringList toremove;
// set the value of properties
cmCacheManager *cachem = this->CMakeInstance->GetCacheManager();
std::vector<std::string> cacheKeys = cachem->GetCacheEntryKeys();
cmState* state = this->CMakeInstance->GetState();
std::vector<std::string> cacheKeys = state->GetCacheEntryKeys();
for(std::vector<std::string>::const_iterator it = cacheKeys.begin();
it != cacheKeys.end(); ++it)
{
cmCacheManager::CacheEntryType t = cachem->GetCacheEntryType(*it);
cmCacheManager::CacheEntryType t = state->GetCacheEntryType(*it);
if(t == cmCacheManager::INTERNAL ||
t == cmCacheManager::STATIC)
{
......@@ -219,11 +219,11 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
prop = props[idx];
if(prop.Value.type() == QVariant::Bool)
{
cachem->SetCacheEntryValue(*it, prop.Value.toBool() ? "ON" : "OFF");
state->SetCacheEntryValue(*it, prop.Value.toBool() ? "ON" : "OFF");
}
else
{
cachem->SetCacheEntryValue(*it,
state->SetCacheEntryValue(*it,
prop.Value.toString().toLocal8Bit().data());
}
props.removeAt(idx);
......@@ -236,7 +236,7 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
{
this->CMakeInstance->UnwatchUnusedCli(s.toLocal8Bit().data());
cachem->RemoveCacheEntry(s.toLocal8Bit().data());
state->RemoveCacheEntry(s.toLocal8Bit().data());
}
// add some new properites
......@@ -281,12 +281,12 @@ QCMakePropertyList QCMake::properties() const
{
QCMakePropertyList ret;
cmCacheManager *cachem = this->CMakeInstance->GetCacheManager();
std::vector<std::string> cacheKeys = cachem->GetCacheEntryKeys();
cmState* state = this->CMakeInstance->GetState();
std::vector<std::string> cacheKeys = state->GetCacheEntryKeys();
for (std::vector<std::string>::const_iterator i = cacheKeys.begin();
i != cacheKeys.end(); ++i)
{
cmCacheManager::CacheEntryType t = cachem->GetCacheEntryType(*i);
cmCacheManager::CacheEntryType t = state->GetCacheEntryType(*i);
if(t == cmCacheManager::INTERNAL ||
t == cmCacheManager::STATIC ||
t == cmCacheManager::UNINITIALIZED)
......@@ -294,14 +294,14 @@ QCMakePropertyList QCMake::properties() const
continue;
}
const char* cachedValue = cachem->GetCacheEntryValue(*i);
const char* cachedValue = state->GetCacheEntryValue(*i);
QCMakeProperty prop;
prop.Key = QString::fromLocal8Bit(i->c_str());
prop.Help = QString::fromLocal8Bit(
cachem->GetCacheEntryProperty(*i, "HELPSTRING"));
state->GetCacheEntryProperty(*i, "HELPSTRING"));
prop.Value = QString::fromLocal8Bit(cachedValue);
prop.Advanced = cachem->GetCacheEntryPropertyAsBool(*i, "ADVANCED");
prop.Advanced = state->GetCacheEntryPropertyAsBool(*i, "ADVANCED");
if(t == cmCacheManager::BOOL)
{
prop.Type = QCMakeProperty::BOOL;
......@@ -319,7 +319,7 @@ QCMakePropertyList QCMake::properties() const
{
prop.Type = QCMakeProperty::STRING;
const char* stringsProperty =
cachem->GetCacheEntryProperty(*i, "STRINGS");
state->GetCacheEntryProperty(*i, "STRINGS");
if (stringsProperty)
{
prop.Strings = QString::fromLocal8Bit(stringsProperty).split(";");
......
......@@ -13,6 +13,7 @@
#include "cmSystemTools.h"
#include "cmMakefile.h"
#include "cmState.h"
#include "cmCommandArgumentLexer.h"
......@@ -90,7 +91,7 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key,
}
if ( strcmp(key, "CACHE") == 0 )
{
if(const char* c = this->Makefile->GetCacheManager()
if(const char* c = this->Makefile->GetState()
->GetInitializedCacheValue(var))
{
if(this->EscapeQuotes)
......
......@@ -16,6 +16,7 @@
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
#include "cmGeneratedFileStream.h"
#include "cmState.h"
#include "cmTarget.h"
#include "cmSourceFile.h"
......@@ -205,7 +206,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
std::string cacheEntryName = "CMAKE_ECLIPSE_ENVVAR_";
cacheEntryName += envVar;
const char* cacheValue = mf->GetCacheManager()->GetInitializedCacheValue(
const char* cacheValue = mf->GetState()->GetInitializedCacheValue(
cacheEntryName);
// now we have both, decide which one to use
......
......@@ -12,6 +12,7 @@
#include "cmFindBase.h"
#include "cmAlgorithms.h"
#include "cmState.h"
cmFindBase::cmFindBase()
{
......@@ -366,8 +367,8 @@ bool cmFindBase::CheckForVariableInCache()
if(const char* cacheValue =
this->Makefile->GetDefinition(this->VariableName))
{
cmCacheManager* manager = this->Makefile->GetCacheManager();
const char* cacheEntry = manager->GetCacheEntryValue(this->VariableName);
cmState* state = this->Makefile->GetState();
const char* cacheEntry = state->GetCacheEntryValue(this->VariableName);
bool found = !cmSystemTools::IsNOTFOUND(cacheValue);
bool cached = cacheEntry ? true : false;
if(found)
......@@ -376,7 +377,7 @@ bool cmFindBase::CheckForVariableInCache()
// type we should add the type and docstring but keep the
// original value. Tell the subclass implementations to do
// this.
if(cached && manager->GetCacheEntryType(this->VariableName)
if(cached && state->GetCacheEntryType(this->VariableName)
== cmCacheManager::UNINITIALIZED)
{
this->AlreadyInCacheWithoutMetaInfo = true;
......@@ -385,7 +386,7 @@ bool cmFindBase::CheckForVariableInCache()
}
else if(cached)
{
const char* hs = manager->GetCacheEntryProperty(this->VariableName,
const char* hs = state->GetCacheEntryProperty(this->VariableName,
"HELPSTRING");
this->VariableDocumentation = hs?hs:"(none)";
}
......
......@@ -12,6 +12,7 @@
#include "cmGetPropertyCommand.h"
#include "cmake.h"
#include "cmState.h"
#include "cmTest.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
......@@ -391,9 +392,9 @@ bool cmGetPropertyCommand::HandleCacheMode()
}
const char* value = 0;
if(this->Makefile->GetCacheManager()->GetCacheEntryValue(this->Name))
if(this->Makefile->GetState()->GetCacheEntryValue(this->Name))
{
value = this->Makefile->GetCacheManager()
value = this->Makefile->GetState()
->GetCacheEntryProperty(this->Name, this->PropertyName);
}
this->StoreResult(value);
......
......@@ -20,6 +20,7 @@
#include "cmLocalGenerator.h"
#include "cmExternalMakefileProjectGenerator.h"
#include "cmake.h"
#include "cmState.h"
#include "cmMakefile.h"
#include "cmQtAutoGenerators.h"
#include "cmSourceFile.h"
......@@ -179,7 +180,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang,
return;
}
const char* cname = this->GetCMakeInstance()->
GetCacheManager()->GetInitializedCacheValue(langComp);
GetState()->GetInitializedCacheValue(langComp);
std::string changeVars;
if(cname && !optional)
{
......@@ -1537,7 +1538,7 @@ void cmGlobalGenerator::CheckLocalGenerators()
std::map<std::string, std::string> notFoundMap;
// std::set<std::string> notFoundMap;
// after it is all done do a ConfigureFinalPass
cmCacheManager* manager = this->GetCMakeInstance()->GetCacheManager();
cmState* state = this->GetCMakeInstance()->GetState();
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
{
this->LocalGenerators[i]->ConfigureFinalPass();
......@@ -1559,7 +1560,7 @@ void cmGlobalGenerator::CheckLocalGenerators()
cmSystemTools::IsNOTFOUND(lib->first.c_str()))
{
std::string varName = lib->first.substr(0, lib->first.size()-9);
if(manager->GetCacheEntryPropertyAsBool(varName, "ADVANCED"))
if(state->GetCacheEntryPropertyAsBool(varName, "ADVANCED"))
{
varName += " (ADVANCED)";
}
......@@ -1590,7 +1591,7 @@ void cmGlobalGenerator::CheckLocalGenerators()
cmSystemTools::IsNOTFOUND(incDir->c_str()))
{
std::string varName = incDir->substr(0, incDir->size()-9);
if(manager->GetCacheEntryPropertyAsBool(varName, "ADVANCED"))
if(state->GetCacheEntryPropertyAsBool(varName, "ADVANCED"))
{
varName += " (ADVANCED)";
}
......@@ -1637,7 +1638,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()->GetInitializedCacheValue
if (!this->CMakeInstance->GetState()->GetInitializedCacheValue
("CMAKE_NUMBER_OF_LOCAL_GENERATORS"))
{
// If CMAKE_NUMBER_OF_LOCAL_GENERATORS is not set
......@@ -1835,7 +1836,7 @@ void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg)
// update progress
// estimate how many lg there will be
const char *numGenC =
this->CMakeInstance->GetCacheManager()->GetInitializedCacheValue
this->CMakeInstance->GetState()->GetInitializedCacheValue
("CMAKE_NUMBER_OF_LOCAL_GENERATORS");
if (!numGenC)
......
......@@ -1812,9 +1812,9 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
bool haveVal = value ? true : false;
std::string val = haveVal ? value : "";
const char* existingValue =
this->GetCacheManager()->GetInitializedCacheValue(name);
this->GetState()->GetInitializedCacheValue(name);
if(existingValue
&& (this->GetCacheManager()->GetCacheEntryType(name)
&& (this->GetState()->GetCacheEntryType(name)
== cmCacheManager::UNINITIALIZED))
{
// if this is not a force, then use the value from the cache
......@@ -1843,14 +1843,14 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
nvalue += files[cc];
}
this->GetCacheManager()->AddCacheEntry(name, nvalue.c_str(), doc, type);
val = this->GetCacheManager()->GetInitializedCacheValue(name);
this->GetState()->AddCacheEntry(name, nvalue.c_str(), doc, type);
val = this->GetState()->GetInitializedCacheValue(name);
haveVal = true;
}
}
this->GetCacheManager()->AddCacheEntry(name, haveVal ? val.c_str() : 0,
doc, type);
this->GetState()->AddCacheEntry(name, haveVal ? val.c_str() : 0,
doc, type);
// if there was a definition then remove it
this->Internal->VarStack.top().Set(name, 0);
}
......@@ -1977,7 +1977,7 @@ void cmMakefile::RemoveDefinition(const std::string& name)
void cmMakefile::RemoveCacheDefinition(const std::string& name)
{
this->GetCacheManager()->RemoveCacheEntry(name);
this->GetState()->RemoveCacheEntry(name);
}
void cmMakefile::SetProjectName(const char* p)
......@@ -2434,7 +2434,7 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const
this->Internal->VarUsageStack.top().insert(name);
if(!def)
{
def = this->GetCacheManager()->GetInitializedCacheValue(name);
def = this->GetState()->GetInitializedCacheValue(name);
}
#ifdef CMAKE_BUILD_WITH_CMAKE
if(cmVariableWatch* vv = this->GetVariableWatch())
......@@ -2459,7 +2459,7 @@ const char* cmMakefile::GetDefinition(const std::string& name) const
const char* def = this->Internal->VarStack.top().Get(name);
if(!def)
{
def = this->GetCacheManager()->GetInitializedCacheValue(name);
def = this->GetState()->GetInitializedCacheValue(name);
}
#ifdef CMAKE_BUILD_WITH_CMAKE
cmVariableWatch* vv = this->GetVariableWatch();
......@@ -2501,7 +2501,7 @@ std::vector<std::string> cmMakefile
res.insert(res.end(), definitions.begin(), definitions.end());
}
std::vector<std::string> cacheKeys =
this->GetCacheManager()->GetCacheEntryKeys();
this->GetState()->GetCacheEntryKeys();
res.insert(res.end(), cacheKeys.begin(), cacheKeys.end());
std::sort(res.begin(), res.end());
......@@ -2802,6 +2802,8 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
openstack.push(t_lookup());
cmake::MessageType mtype = cmake::LOG;
cmState* state = this->GetCMakeInstance()->GetState();
do
{
char inc = *in;
......@@ -2835,8 +2837,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
value = cmSystemTools::GetEnv(lookup.c_str());
break;
case CACHE:
value = this->GetCacheManager()
->GetInitializedCacheValue(lookup);
value = state->GetCacheEntryValue(lookup);
break;
}
// Get the string we're meant to append to.
......@@ -4908,7 +4909,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
if(id == cmPolicies::CMP0001 &&
(status == cmPolicies::WARN || status == cmPolicies::OLD))
{
if(!(this->GetCacheManager()
if(!(this->GetState()
->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")))
{
// Set it to 2.4 because that is the last version where the
......
......@@ -36,20 +36,20 @@ bool cmMarkAsAdvancedCommand
for(; i < args.size(); ++i)
{
std::string variable = args[i];
cmCacheManager* manager = this->Makefile->GetCacheManager();
if (!manager->GetCacheEntryValue(variable))
cmState* state = this->Makefile->GetState();
if (!state->GetCacheEntryValue(variable))
{
manager->AddCacheEntry(variable, 0, 0, cmCacheManager::UNINITIALIZED);
state->AddCacheEntry(variable, 0, 0, cmCacheManager::UNINITIALIZED);
overwrite = true;
}
if (!manager->GetCacheEntryValue(variable))
if (!state->GetCacheEntryValue(variable))
{
cmSystemTools::Error("This should never happen...");
return false;
}
if (!manager->GetCacheEntryProperty(variable, "ADVANCED") || overwrite)
if (!state->GetCacheEntryProperty(variable, "ADVANCED") || overwrite)
{
manager->SetCacheEntryProperty(variable, "ADVANCED", value);
state->SetCacheEntryProperty(variable, "ADVANCED", value);
}
}
return true;
......
......@@ -42,13 +42,13 @@ bool cmOptionCommand
std::string initialValue = "Off";
// Now check and see if the value has been stored in the cache
// already, if so use that value and don't look for the program
cmCacheManager* manager = this->Makefile->GetCacheManager();
const char* existingValue = manager->GetCacheEntryValue(args[0]);
cmState* state = this->Makefile->GetState();
const char* existingValue = state->GetCacheEntryValue(args[0]);
if(existingValue)
{
if (manager->GetCacheEntryType(args[0]) != cmCacheManager::UNINITIALIZED)
if (state->GetCacheEntryType(args[0]) != cmCacheManager::UNINITIALIZED)
{
manager->SetCacheEntryProperty(args[0], "HELPSTRING", args[1]);
state->SetCacheEntryProperty(args[0], "HELPSTRING", args[1]);
return true;
}
initialValue = existingValue;
......
......@@ -136,10 +136,10 @@ bool cmSetCommand
}
// see if this is already in the cache
cmCacheManager* manager = this->Makefile->GetCacheManager();
const char* existingValue = manager->GetCacheEntryValue(variable);
cmState* state = this->Makefile->GetState();
const char* existingValue = state->GetCacheEntryValue(variable);
if(existingValue &&
(manager->GetCacheEntryType(variable) != cmCacheManager::UNINITIALIZED))
(state->GetCacheEntryType(variable) != cmCacheManager::UNINITIALIZED))
{
// if the set is trying to CACHE the value but the value
// is already in the cache and the type is not internal
......
......@@ -453,7 +453,7 @@ bool cmSetPropertyCommand::HandleCacheMode()
cmMakefile* mf = this->GetMakefile();
cmake* cm = mf->GetCMakeInstance();
const char* existingValue
= cm->GetCacheManager()->GetCacheEntryValue(*ni);
= cm->GetState()->GetCacheEntryValue(*ni);
if(existingValue)
{
if(!this->HandleCacheEntry(*ni))
......@@ -479,20 +479,19 @@ bool cmSetPropertyCommand::HandleCacheEntry(std::string const& cacheKey)
// Set or append the property.
const char* name = this->PropertyName.c_str();
const char* value = this->PropertyValue.c_str();
cmCacheManager* manager = this->Makefile->GetCacheManager();
cmState* state = this->Makefile->GetState();
if (this->Remove)
{
manager->RemoveCacheEntryProperty(cacheKey, name);
return true;
state->RemoveCacheEntryProperty(cacheKey, name);
}
if(this->AppendMode)
{
manager->AppendCacheEntryProperty(cacheKey, name, value,
this->AppendAsString);
state->AppendCacheEntryProperty(cacheKey, name, value,
this->AppendAsString);
}
else
{
manager->SetCacheEntryProperty(cacheKey, name, value);
state->SetCacheEntryProperty(cacheKey, name, value);
}
return true;
......
......@@ -264,12 +264,12 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
comment.c_str(),
cmCacheManager::STRING);
cmCacheManager* manager = this->Makefile->GetCacheManager();
cmState* state = this->Makefile->GetState();
const char* existingValue
= manager->GetCacheEntryValue(this->RunResultVariable);
= state->GetCacheEntryValue(this->RunResultVariable);
if (existingValue)
{
manager->SetCacheEntryProperty(this->RunResultVariable, "ADVANCED", "1");
state->SetCacheEntryProperty(this->RunResultVariable, "ADVANCED", "1");
}
error = true;
......@@ -291,13 +291,13 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
"PLEASE_FILL_OUT-NOTFOUND",
comment.c_str(),
cmCacheManager::STRING);
cmCacheManager* manager = this->Makefile->GetCacheManager();
cmState* state = this->Makefile->GetState();
const char* existing =
manager->GetCacheEntryValue(internalRunOutputName);
state->GetCacheEntryValue(internalRunOutputName);
if (existing)
{
manager->SetCacheEntryProperty(internalRunOutputName,
"ADVANCED", "1");
state->SetCacheEntryProperty(internalRunOutputName,
"ADVANCED", "1");
}