Port to cmState.

This commit is contained in:
Stephen Kelly 2015-04-06 10:52:45 +02:00 committed by Brad King
parent a6b1ad1309
commit ff7169a03c
19 changed files with 156 additions and 151 deletions

View File

@ -9,7 +9,6 @@
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information. See the License for more information.
============================================================================*/ ============================================================================*/
#include "../cmCacheManager.h"
#include "../cmSystemTools.h" #include "../cmSystemTools.h"
#include "../cmake.h" #include "../cmake.h"
#include "../cmDocumentation.h" #include "../cmDocumentation.h"

View File

@ -19,6 +19,7 @@
#include "cmCursesDummyWidget.h" #include "cmCursesDummyWidget.h"
#include "../cmSystemTools.h" #include "../cmSystemTools.h"
#include "../cmake.h" #include "../cmake.h"
#include "../cmState.h"
#include <assert.h> #include <assert.h>
@ -50,9 +51,9 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
} }
this->Entry = 0; this->Entry = 0;
const char* value = cm->GetCacheManager()->GetCacheEntryValue(key); const char* value = cm->GetState()->GetCacheEntryValue(key);
assert(value); assert(value);
switch (cm->GetCacheManager()->GetCacheEntryType(key)) switch (cm->GetState()->GetCacheEntryType(key))
{ {
case cmCacheManager::BOOL: case cmCacheManager::BOOL:
this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1); this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1);
@ -75,7 +76,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
break; break;
case cmCacheManager::STRING: case cmCacheManager::STRING:
{ {
const char* stringsProp = cm->GetCacheManager() const char* stringsProp = cm->GetState()
->GetCacheEntryProperty(key, "STRINGS"); ->GetCacheEntryProperty(key, "STRINGS");
if(stringsProp) if(stringsProp)
{ {

View File

@ -9,7 +9,6 @@
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information. See the License for more information.
============================================================================*/ ============================================================================*/
#include "../cmCacheManager.h"
#include "../cmSystemTools.h" #include "../cmSystemTools.h"
#include "../cmake.h" #include "../cmake.h"
#include "../cmVersion.h" #include "../cmVersion.h"

View File

@ -23,6 +23,7 @@
#include "cmCursesCacheEntryComposite.h" #include "cmCursesCacheEntryComposite.h"
#include "cmCursesLongMessageForm.h" #include "cmCursesLongMessageForm.h"
#include "cmAlgorithms.h" #include "cmAlgorithms.h"
#include "cmState.h"
inline int ctrl(int z) inline int ctrl(int z)
@ -107,17 +108,17 @@ void cmCursesMainForm::InitializeUI()
// which contain labels, entries and new entry markers // which contain labels, entries and new entry markers
std::vector<cmCursesCacheEntryComposite*>* newEntries = std::vector<cmCursesCacheEntryComposite*>* newEntries =
new std::vector<cmCursesCacheEntryComposite*>; 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 // Count non-internal and non-static entries
int count=0; int count=0;
std::vector<std::string> cacheKeys =
this->CMakeInstance->GetCacheManager()->GetCacheEntryKeys();
for(std::vector<std::string>::const_iterator it = cacheKeys.begin(); for(std::vector<std::string>::const_iterator it = cacheKeys.begin();
it != cacheKeys.end(); ++it) it != cacheKeys.end(); ++it)
{ {
cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager() cmCacheManager::CacheEntryType t = this->CMakeInstance->GetState()
->GetCacheEntryType(*it); ->GetCacheEntryType(*it);
if (t != cmCacheManager::INTERNAL && if (t != cmCacheManager::INTERNAL &&
t != cmCacheManager::STATIC && t != cmCacheManager::STATIC &&
@ -147,7 +148,7 @@ void cmCursesMainForm::InitializeUI()
it != cacheKeys.end(); ++it) it != cacheKeys.end(); ++it)
{ {
std::string key = *it; std::string key = *it;
cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager() cmCacheManager::CacheEntryType t = this->CMakeInstance->GetState()
->GetCacheEntryType(*it); ->GetCacheEntryType(*it);
if (t == cmCacheManager::INTERNAL || if (t == cmCacheManager::INTERNAL ||
t == cmCacheManager::STATIC || t == cmCacheManager::STATIC ||
@ -171,7 +172,7 @@ void cmCursesMainForm::InitializeUI()
it != cacheKeys.end(); ++it) it != cacheKeys.end(); ++it)
{ {
std::string key = *it; std::string key = *it;
cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager() cmCacheManager::CacheEntryType t = this->CMakeInstance->GetState()
->GetCacheEntryType(*it); ->GetCacheEntryType(*it);
if (t == cmCacheManager::INTERNAL || if (t == cmCacheManager::INTERNAL ||
t == cmCacheManager::STATIC || t == cmCacheManager::STATIC ||
@ -225,10 +226,10 @@ void cmCursesMainForm::RePost()
for (it = this->Entries->begin(); it != this->Entries->end(); ++it) for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{ {
const char* existingValue = const char* existingValue =
this->CMakeInstance->GetCacheManager() this->CMakeInstance->GetState()
->GetCacheEntryValue((*it)->GetValue()); ->GetCacheEntryValue((*it)->GetValue());
bool advanced = bool advanced =
this->CMakeInstance->GetCacheManager() this->CMakeInstance->GetState()
->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED"); ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
if (!existingValue || (!this->AdvancedMode && advanced)) if (!existingValue || (!this->AdvancedMode && advanced))
{ {
@ -257,10 +258,10 @@ void cmCursesMainForm::RePost()
for (it = this->Entries->begin(); it != this->Entries->end(); ++it) for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{ {
const char* existingValue = const char* existingValue =
this->CMakeInstance->GetCacheManager() this->CMakeInstance->GetState()
->GetCacheEntryValue((*it)->GetValue()); ->GetCacheEntryValue((*it)->GetValue());
bool advanced = bool advanced =
this->CMakeInstance->GetCacheManager() this->CMakeInstance->GetState()
->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED"); ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
if (!existingValue || (!this->AdvancedMode && 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) for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{ {
const char* existingValue = const char* existingValue =
this->CMakeInstance->GetCacheManager() this->CMakeInstance->GetState()
->GetCacheEntryValue((*it)->GetValue()); ->GetCacheEntryValue((*it)->GetValue());
bool advanced = bool advanced =
this->CMakeInstance->GetCacheManager() this->CMakeInstance->GetState()
->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED"); ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
if (!existingValue || (!this->AdvancedMode && 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) for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
{ {
const char* existingValue = const char* existingValue =
this->CMakeInstance->GetCacheManager() this->CMakeInstance->GetState()
->GetCacheEntryValue((*it)->GetValue()); ->GetCacheEntryValue((*it)->GetValue());
bool advanced = bool advanced =
this->CMakeInstance->GetCacheManager() this->CMakeInstance->GetState()
->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED"); ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
if (!existingValue || (!this->AdvancedMode && advanced)) if (!existingValue || (!this->AdvancedMode && advanced))
{ {
@ -516,10 +517,10 @@ void cmCursesMainForm::UpdateStatusBar(const char* message)
// Get the help string of the current entry // Get the help string of the current entry
// and add it to the help string // and add it to the help string
const char* existingValue = const char* existingValue =
this->CMakeInstance->GetCacheManager()->GetCacheEntryValue(curField); this->CMakeInstance->GetState()->GetCacheEntryValue(curField);
if (existingValue) if (existingValue)
{ {
const char* hs = this->CMakeInstance->GetCacheManager() const char* hs = this->CMakeInstance->GetState()
->GetCacheEntryProperty(curField, "HELPSTRING"); ->GetCacheEntryProperty(curField, "HELPSTRING");
if ( hs ) if ( hs )
{ {
@ -814,7 +815,7 @@ void cmCursesMainForm::FillCacheManagerFromUI()
for(size_t i=0; i < size; i++) for(size_t i=0; i < size; i++)
{ {
std::string cacheKey = (*this->Entries)[i]->Key; std::string cacheKey = (*this->Entries)[i]->Key;
const char* existingValue = this->CMakeInstance->GetCacheManager() const char* existingValue = this->CMakeInstance->GetState()
->GetCacheEntryValue(cacheKey); ->GetCacheEntryValue(cacheKey);
if (existingValue) if (existingValue)
{ {
@ -823,7 +824,7 @@ void cmCursesMainForm::FillCacheManagerFromUI()
std::string fixedOldValue; std::string fixedOldValue;
std::string fixedNewValue; std::string fixedNewValue;
cmCacheManager::CacheEntryType t = cmCacheManager::CacheEntryType t =
this->CMakeInstance->GetCacheManager() this->CMakeInstance->GetState()
->GetCacheEntryType(cacheKey); ->GetCacheEntryType(cacheKey);
this->FixValue(t, oldValue, fixedOldValue); this->FixValue(t, oldValue, fixedOldValue);
this->FixValue(t, newValue, fixedNewValue); this->FixValue(t, newValue, fixedNewValue);
@ -831,9 +832,9 @@ void cmCursesMainForm::FillCacheManagerFromUI()
if(!(fixedOldValue == fixedNewValue)) if(!(fixedOldValue == fixedNewValue))
{ {
// The user has changed the value. Mark it as modified. // The user has changed the value. Mark it as modified.
this->CMakeInstance->GetCacheManager() this->CMakeInstance->GetState()
->SetCacheEntryBoolProperty(cacheKey, "MODIFIED", true); ->SetCacheEntryBoolProperty(cacheKey, "MODIFIED", true);
this->CMakeInstance->GetCacheManager() this->CMakeInstance->GetState()
->SetCacheEntryValue(cacheKey, fixedNewValue); ->SetCacheEntryValue(cacheKey, fixedNewValue);
} }
} }
@ -1046,11 +1047,11 @@ void cmCursesMainForm::HandleInput()
const char* helpString = 0; const char* helpString = 0;
const char* existingValue = const char* existingValue =
this->CMakeInstance->GetCacheManager() this->CMakeInstance->GetState()
->GetCacheEntryValue(curField); ->GetCacheEntryValue(curField);
if (existingValue) if (existingValue)
{ {
helpString = this->CMakeInstance->GetCacheManager() helpString = this->CMakeInstance->GetState()
->GetCacheEntryProperty(curField, "HELPSTRING"); ->GetCacheEntryProperty(curField, "HELPSTRING");
} }
if (helpString) if (helpString)
@ -1161,7 +1162,7 @@ void cmCursesMainForm::HandleInput()
field_userptr(this->Fields[findex-2])); field_userptr(this->Fields[findex-2]));
if ( lbl ) if ( lbl )
{ {
this->CMakeInstance->GetCacheManager()->RemoveCacheEntry(lbl->GetValue()); this->CMakeInstance->GetState()->RemoveCacheEntry(lbl->GetValue());
std::string nextVal; std::string nextVal;
if (nextCur) if (nextCur)

View File

@ -16,7 +16,7 @@
#include <QCoreApplication> #include <QCoreApplication>
#include "cmake.h" #include "cmake.h"
#include "cmCacheManager.h" #include "cmState.h"
#include "cmSystemTools.h" #include "cmSystemTools.h"
#include "cmExternalMakefileProjectGenerator.h" #include "cmExternalMakefileProjectGenerator.h"
@ -94,7 +94,7 @@ void QCMake::setBinaryDirectory(const QString& _dir)
{ {
this->BinaryDirectory = QDir::fromNativeSeparators(dir); this->BinaryDirectory = QDir::fromNativeSeparators(dir);
emit this->binaryDirChanged(this->BinaryDirectory); emit this->binaryDirChanged(this->BinaryDirectory);
cmCacheManager *cachem = this->CMakeInstance->GetCacheManager(); cmState* state = this->CMakeInstance->GetState();
this->setGenerator(QString()); this->setGenerator(QString());
if(!this->CMakeInstance->LoadCache( if(!this->CMakeInstance->LoadCache(
this->BinaryDirectory.toLocal8Bit().data())) this->BinaryDirectory.toLocal8Bit().data()))
@ -110,15 +110,15 @@ void QCMake::setBinaryDirectory(const QString& _dir)
QCMakePropertyList props = this->properties(); QCMakePropertyList props = this->properties();
emit this->propertiesChanged(props); emit this->propertiesChanged(props);
const char* homeDir = cachem->GetCacheEntryValue("CMAKE_HOME_DIRECTORY"); const char* homeDir = state->GetCacheEntryValue("CMAKE_HOME_DIRECTORY");
if (homeDir) if (homeDir)
{ {
setSourceDirectory(QString::fromLocal8Bit(homeDir)); setSourceDirectory(QString::fromLocal8Bit(homeDir));
} }
const char* gen = cachem->GetCacheEntryValue("CMAKE_GENERATOR"); const char* gen = state->GetCacheEntryValue("CMAKE_GENERATOR");
if (gen) if (gen)
{ {
const char* extraGen = cachem const char* extraGen = state
->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR"); ->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
std::string curGen = cmExternalMakefileProjectGenerator:: std::string curGen = cmExternalMakefileProjectGenerator::
CreateFullGeneratorName(gen, extraGen? extraGen : ""); CreateFullGeneratorName(gen, extraGen? extraGen : "");
@ -195,12 +195,12 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
QStringList toremove; QStringList toremove;
// set the value of properties // set the value of properties
cmCacheManager *cachem = this->CMakeInstance->GetCacheManager(); cmState* state = this->CMakeInstance->GetState();
std::vector<std::string> cacheKeys = cachem->GetCacheEntryKeys(); std::vector<std::string> cacheKeys = state->GetCacheEntryKeys();
for(std::vector<std::string>::const_iterator it = cacheKeys.begin(); for(std::vector<std::string>::const_iterator it = cacheKeys.begin();
it != cacheKeys.end(); ++it) it != cacheKeys.end(); ++it)
{ {
cmCacheManager::CacheEntryType t = cachem->GetCacheEntryType(*it); cmCacheManager::CacheEntryType t = state->GetCacheEntryType(*it);
if(t == cmCacheManager::INTERNAL || if(t == cmCacheManager::INTERNAL ||
t == cmCacheManager::STATIC) t == cmCacheManager::STATIC)
{ {
@ -219,11 +219,11 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
prop = props[idx]; prop = props[idx];
if(prop.Value.type() == QVariant::Bool) if(prop.Value.type() == QVariant::Bool)
{ {
cachem->SetCacheEntryValue(*it, prop.Value.toBool() ? "ON" : "OFF"); state->SetCacheEntryValue(*it, prop.Value.toBool() ? "ON" : "OFF");
} }
else else
{ {
cachem->SetCacheEntryValue(*it, state->SetCacheEntryValue(*it,
prop.Value.toString().toLocal8Bit().data()); prop.Value.toString().toLocal8Bit().data());
} }
props.removeAt(idx); props.removeAt(idx);
@ -236,7 +236,7 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
{ {
this->CMakeInstance->UnwatchUnusedCli(s.toLocal8Bit().data()); this->CMakeInstance->UnwatchUnusedCli(s.toLocal8Bit().data());
cachem->RemoveCacheEntry(s.toLocal8Bit().data()); state->RemoveCacheEntry(s.toLocal8Bit().data());
} }
// add some new properites // add some new properites
@ -281,12 +281,12 @@ QCMakePropertyList QCMake::properties() const
{ {
QCMakePropertyList ret; QCMakePropertyList ret;
cmCacheManager *cachem = this->CMakeInstance->GetCacheManager(); cmState* state = this->CMakeInstance->GetState();
std::vector<std::string> cacheKeys = cachem->GetCacheEntryKeys(); std::vector<std::string> cacheKeys = state->GetCacheEntryKeys();
for (std::vector<std::string>::const_iterator i = cacheKeys.begin(); for (std::vector<std::string>::const_iterator i = cacheKeys.begin();
i != cacheKeys.end(); ++i) i != cacheKeys.end(); ++i)
{ {
cmCacheManager::CacheEntryType t = cachem->GetCacheEntryType(*i); cmCacheManager::CacheEntryType t = state->GetCacheEntryType(*i);
if(t == cmCacheManager::INTERNAL || if(t == cmCacheManager::INTERNAL ||
t == cmCacheManager::STATIC || t == cmCacheManager::STATIC ||
t == cmCacheManager::UNINITIALIZED) t == cmCacheManager::UNINITIALIZED)
@ -294,14 +294,14 @@ QCMakePropertyList QCMake::properties() const
continue; continue;
} }
const char* cachedValue = cachem->GetCacheEntryValue(*i); const char* cachedValue = state->GetCacheEntryValue(*i);
QCMakeProperty prop; QCMakeProperty prop;
prop.Key = QString::fromLocal8Bit(i->c_str()); prop.Key = QString::fromLocal8Bit(i->c_str());
prop.Help = QString::fromLocal8Bit( prop.Help = QString::fromLocal8Bit(
cachem->GetCacheEntryProperty(*i, "HELPSTRING")); state->GetCacheEntryProperty(*i, "HELPSTRING"));
prop.Value = QString::fromLocal8Bit(cachedValue); prop.Value = QString::fromLocal8Bit(cachedValue);
prop.Advanced = cachem->GetCacheEntryPropertyAsBool(*i, "ADVANCED"); prop.Advanced = state->GetCacheEntryPropertyAsBool(*i, "ADVANCED");
if(t == cmCacheManager::BOOL) if(t == cmCacheManager::BOOL)
{ {
prop.Type = QCMakeProperty::BOOL; prop.Type = QCMakeProperty::BOOL;
@ -319,7 +319,7 @@ QCMakePropertyList QCMake::properties() const
{ {
prop.Type = QCMakeProperty::STRING; prop.Type = QCMakeProperty::STRING;
const char* stringsProperty = const char* stringsProperty =
cachem->GetCacheEntryProperty(*i, "STRINGS"); state->GetCacheEntryProperty(*i, "STRINGS");
if (stringsProperty) if (stringsProperty)
{ {
prop.Strings = QString::fromLocal8Bit(stringsProperty).split(";"); prop.Strings = QString::fromLocal8Bit(stringsProperty).split(";");

View File

@ -13,6 +13,7 @@
#include "cmSystemTools.h" #include "cmSystemTools.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmState.h"
#include "cmCommandArgumentLexer.h" #include "cmCommandArgumentLexer.h"
@ -90,7 +91,7 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key,
} }
if ( strcmp(key, "CACHE") == 0 ) if ( strcmp(key, "CACHE") == 0 )
{ {
if(const char* c = this->Makefile->GetCacheManager() if(const char* c = this->Makefile->GetState()
->GetInitializedCacheValue(var)) ->GetInitializedCacheValue(var))
{ {
if(this->EscapeQuotes) if(this->EscapeQuotes)

View File

@ -16,6 +16,7 @@
#include "cmLocalUnixMakefileGenerator3.h" #include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmGeneratedFileStream.h" #include "cmGeneratedFileStream.h"
#include "cmState.h"
#include "cmTarget.h" #include "cmTarget.h"
#include "cmSourceFile.h" #include "cmSourceFile.h"
@ -205,7 +206,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
std::string cacheEntryName = "CMAKE_ECLIPSE_ENVVAR_"; std::string cacheEntryName = "CMAKE_ECLIPSE_ENVVAR_";
cacheEntryName += envVar; cacheEntryName += envVar;
const char* cacheValue = mf->GetCacheManager()->GetInitializedCacheValue( const char* cacheValue = mf->GetState()->GetInitializedCacheValue(
cacheEntryName); cacheEntryName);
// now we have both, decide which one to use // now we have both, decide which one to use

View File

@ -12,6 +12,7 @@
#include "cmFindBase.h" #include "cmFindBase.h"
#include "cmAlgorithms.h" #include "cmAlgorithms.h"
#include "cmState.h"
cmFindBase::cmFindBase() cmFindBase::cmFindBase()
{ {
@ -366,8 +367,8 @@ bool cmFindBase::CheckForVariableInCache()
if(const char* cacheValue = if(const char* cacheValue =
this->Makefile->GetDefinition(this->VariableName)) this->Makefile->GetDefinition(this->VariableName))
{ {
cmCacheManager* manager = this->Makefile->GetCacheManager(); cmState* state = this->Makefile->GetState();
const char* cacheEntry = manager->GetCacheEntryValue(this->VariableName); const char* cacheEntry = state->GetCacheEntryValue(this->VariableName);
bool found = !cmSystemTools::IsNOTFOUND(cacheValue); bool found = !cmSystemTools::IsNOTFOUND(cacheValue);
bool cached = cacheEntry ? true : false; bool cached = cacheEntry ? true : false;
if(found) if(found)
@ -376,7 +377,7 @@ bool cmFindBase::CheckForVariableInCache()
// type we should add the type and docstring but keep the // type we should add the type and docstring but keep the
// original value. Tell the subclass implementations to do // original value. Tell the subclass implementations to do
// this. // this.
if(cached && manager->GetCacheEntryType(this->VariableName) if(cached && state->GetCacheEntryType(this->VariableName)
== cmCacheManager::UNINITIALIZED) == cmCacheManager::UNINITIALIZED)
{ {
this->AlreadyInCacheWithoutMetaInfo = true; this->AlreadyInCacheWithoutMetaInfo = true;
@ -385,7 +386,7 @@ bool cmFindBase::CheckForVariableInCache()
} }
else if(cached) else if(cached)
{ {
const char* hs = manager->GetCacheEntryProperty(this->VariableName, const char* hs = state->GetCacheEntryProperty(this->VariableName,
"HELPSTRING"); "HELPSTRING");
this->VariableDocumentation = hs?hs:"(none)"; this->VariableDocumentation = hs?hs:"(none)";
} }

View File

@ -12,6 +12,7 @@
#include "cmGetPropertyCommand.h" #include "cmGetPropertyCommand.h"
#include "cmake.h" #include "cmake.h"
#include "cmState.h"
#include "cmTest.h" #include "cmTest.h"
#include "cmGlobalGenerator.h" #include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h" #include "cmLocalGenerator.h"
@ -391,9 +392,9 @@ bool cmGetPropertyCommand::HandleCacheMode()
} }
const char* value = 0; 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); ->GetCacheEntryProperty(this->Name, this->PropertyName);
} }
this->StoreResult(value); this->StoreResult(value);

View File

@ -20,6 +20,7 @@
#include "cmLocalGenerator.h" #include "cmLocalGenerator.h"
#include "cmExternalMakefileProjectGenerator.h" #include "cmExternalMakefileProjectGenerator.h"
#include "cmake.h" #include "cmake.h"
#include "cmState.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmQtAutoGenerators.h" #include "cmQtAutoGenerators.h"
#include "cmSourceFile.h" #include "cmSourceFile.h"
@ -179,7 +180,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang,
return; return;
} }
const char* cname = this->GetCMakeInstance()-> const char* cname = this->GetCMakeInstance()->
GetCacheManager()->GetInitializedCacheValue(langComp); GetState()->GetInitializedCacheValue(langComp);
std::string changeVars; std::string changeVars;
if(cname && !optional) if(cname && !optional)
{ {
@ -1537,7 +1538,7 @@ void cmGlobalGenerator::CheckLocalGenerators()
std::map<std::string, std::string> notFoundMap; std::map<std::string, std::string> notFoundMap;
// std::set<std::string> notFoundMap; // std::set<std::string> notFoundMap;
// after it is all done do a ConfigureFinalPass // 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) for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
{ {
this->LocalGenerators[i]->ConfigureFinalPass(); this->LocalGenerators[i]->ConfigureFinalPass();
@ -1559,7 +1560,7 @@ void cmGlobalGenerator::CheckLocalGenerators()
cmSystemTools::IsNOTFOUND(lib->first.c_str())) cmSystemTools::IsNOTFOUND(lib->first.c_str()))
{ {
std::string varName = lib->first.substr(0, lib->first.size()-9); std::string varName = lib->first.substr(0, lib->first.size()-9);
if(manager->GetCacheEntryPropertyAsBool(varName, "ADVANCED")) if(state->GetCacheEntryPropertyAsBool(varName, "ADVANCED"))
{ {
varName += " (ADVANCED)"; varName += " (ADVANCED)";
} }
@ -1590,7 +1591,7 @@ void cmGlobalGenerator::CheckLocalGenerators()
cmSystemTools::IsNOTFOUND(incDir->c_str())) cmSystemTools::IsNOTFOUND(incDir->c_str()))
{ {
std::string varName = incDir->substr(0, incDir->size()-9); std::string varName = incDir->substr(0, incDir->size()-9);
if(manager->GetCacheEntryPropertyAsBool(varName, "ADVANCED")) if(state->GetCacheEntryPropertyAsBool(varName, "ADVANCED"))
{ {
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 // and there is a good chance that the try compile stuff will
// take the bulk of the time, so try and guess some progress // take the bulk of the time, so try and guess some progress
// by getting closer and closer to 100 without actually getting there. // 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")) ("CMAKE_NUMBER_OF_LOCAL_GENERATORS"))
{ {
// If CMAKE_NUMBER_OF_LOCAL_GENERATORS is not set // If CMAKE_NUMBER_OF_LOCAL_GENERATORS is not set
@ -1835,7 +1836,7 @@ void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg)
// update progress // update progress
// estimate how many lg there will be // estimate how many lg there will be
const char *numGenC = const char *numGenC =
this->CMakeInstance->GetCacheManager()->GetInitializedCacheValue this->CMakeInstance->GetState()->GetInitializedCacheValue
("CMAKE_NUMBER_OF_LOCAL_GENERATORS"); ("CMAKE_NUMBER_OF_LOCAL_GENERATORS");
if (!numGenC) if (!numGenC)

View File

@ -1812,9 +1812,9 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
bool haveVal = value ? true : false; bool haveVal = value ? true : false;
std::string val = haveVal ? value : ""; std::string val = haveVal ? value : "";
const char* existingValue = const char* existingValue =
this->GetCacheManager()->GetInitializedCacheValue(name); this->GetState()->GetInitializedCacheValue(name);
if(existingValue if(existingValue
&& (this->GetCacheManager()->GetCacheEntryType(name) && (this->GetState()->GetCacheEntryType(name)
== cmCacheManager::UNINITIALIZED)) == cmCacheManager::UNINITIALIZED))
{ {
// if this is not a force, then use the value from the cache // if this is not a force, then use the value from the cache
@ -1843,13 +1843,13 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
nvalue += files[cc]; nvalue += files[cc];
} }
this->GetCacheManager()->AddCacheEntry(name, nvalue.c_str(), doc, type); this->GetState()->AddCacheEntry(name, nvalue.c_str(), doc, type);
val = this->GetCacheManager()->GetInitializedCacheValue(name); val = this->GetState()->GetInitializedCacheValue(name);
haveVal = true; haveVal = true;
} }
} }
this->GetCacheManager()->AddCacheEntry(name, haveVal ? val.c_str() : 0, this->GetState()->AddCacheEntry(name, haveVal ? val.c_str() : 0,
doc, type); doc, type);
// if there was a definition then remove it // if there was a definition then remove it
this->Internal->VarStack.top().Set(name, 0); 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) void cmMakefile::RemoveCacheDefinition(const std::string& name)
{ {
this->GetCacheManager()->RemoveCacheEntry(name); this->GetState()->RemoveCacheEntry(name);
} }
void cmMakefile::SetProjectName(const char* p) void cmMakefile::SetProjectName(const char* p)
@ -2434,7 +2434,7 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const
this->Internal->VarUsageStack.top().insert(name); this->Internal->VarUsageStack.top().insert(name);
if(!def) if(!def)
{ {
def = this->GetCacheManager()->GetInitializedCacheValue(name); def = this->GetState()->GetInitializedCacheValue(name);
} }
#ifdef CMAKE_BUILD_WITH_CMAKE #ifdef CMAKE_BUILD_WITH_CMAKE
if(cmVariableWatch* vv = this->GetVariableWatch()) 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); const char* def = this->Internal->VarStack.top().Get(name);
if(!def) if(!def)
{ {
def = this->GetCacheManager()->GetInitializedCacheValue(name); def = this->GetState()->GetInitializedCacheValue(name);
} }
#ifdef CMAKE_BUILD_WITH_CMAKE #ifdef CMAKE_BUILD_WITH_CMAKE
cmVariableWatch* vv = this->GetVariableWatch(); cmVariableWatch* vv = this->GetVariableWatch();
@ -2501,7 +2501,7 @@ std::vector<std::string> cmMakefile
res.insert(res.end(), definitions.begin(), definitions.end()); res.insert(res.end(), definitions.begin(), definitions.end());
} }
std::vector<std::string> cacheKeys = std::vector<std::string> cacheKeys =
this->GetCacheManager()->GetCacheEntryKeys(); this->GetState()->GetCacheEntryKeys();
res.insert(res.end(), cacheKeys.begin(), cacheKeys.end()); res.insert(res.end(), cacheKeys.begin(), cacheKeys.end());
std::sort(res.begin(), res.end()); std::sort(res.begin(), res.end());
@ -2802,6 +2802,8 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
openstack.push(t_lookup()); openstack.push(t_lookup());
cmake::MessageType mtype = cmake::LOG; cmake::MessageType mtype = cmake::LOG;
cmState* state = this->GetCMakeInstance()->GetState();
do do
{ {
char inc = *in; char inc = *in;
@ -2835,8 +2837,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
value = cmSystemTools::GetEnv(lookup.c_str()); value = cmSystemTools::GetEnv(lookup.c_str());
break; break;
case CACHE: case CACHE:
value = this->GetCacheManager() value = state->GetCacheEntryValue(lookup);
->GetInitializedCacheValue(lookup);
break; break;
} }
// Get the string we're meant to append to. // Get the string we're meant to append to.
@ -4908,7 +4909,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
if(id == cmPolicies::CMP0001 && if(id == cmPolicies::CMP0001 &&
(status == cmPolicies::WARN || status == cmPolicies::OLD)) (status == cmPolicies::WARN || status == cmPolicies::OLD))
{ {
if(!(this->GetCacheManager() if(!(this->GetState()
->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))) ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")))
{ {
// Set it to 2.4 because that is the last version where the // Set it to 2.4 because that is the last version where the

View File

@ -36,20 +36,20 @@ bool cmMarkAsAdvancedCommand
for(; i < args.size(); ++i) for(; i < args.size(); ++i)
{ {
std::string variable = args[i]; std::string variable = args[i];
cmCacheManager* manager = this->Makefile->GetCacheManager(); cmState* state = this->Makefile->GetState();
if (!manager->GetCacheEntryValue(variable)) if (!state->GetCacheEntryValue(variable))
{ {
manager->AddCacheEntry(variable, 0, 0, cmCacheManager::UNINITIALIZED); state->AddCacheEntry(variable, 0, 0, cmCacheManager::UNINITIALIZED);
overwrite = true; overwrite = true;
} }
if (!manager->GetCacheEntryValue(variable)) if (!state->GetCacheEntryValue(variable))
{ {
cmSystemTools::Error("This should never happen..."); cmSystemTools::Error("This should never happen...");
return false; 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; return true;

View File

@ -42,13 +42,13 @@ bool cmOptionCommand
std::string initialValue = "Off"; std::string initialValue = "Off";
// Now check and see if the value has been stored in the cache // 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 // already, if so use that value and don't look for the program
cmCacheManager* manager = this->Makefile->GetCacheManager(); cmState* state = this->Makefile->GetState();
const char* existingValue = manager->GetCacheEntryValue(args[0]); const char* existingValue = state->GetCacheEntryValue(args[0]);
if(existingValue) 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; return true;
} }
initialValue = existingValue; initialValue = existingValue;

View File

@ -136,10 +136,10 @@ bool cmSetCommand
} }
// see if this is already in the cache // see if this is already in the cache
cmCacheManager* manager = this->Makefile->GetCacheManager(); cmState* state = this->Makefile->GetState();
const char* existingValue = manager->GetCacheEntryValue(variable); const char* existingValue = state->GetCacheEntryValue(variable);
if(existingValue && if(existingValue &&
(manager->GetCacheEntryType(variable) != cmCacheManager::UNINITIALIZED)) (state->GetCacheEntryType(variable) != cmCacheManager::UNINITIALIZED))
{ {
// if the set is trying to CACHE the value but the value // if the set is trying to CACHE the value but the value
// is already in the cache and the type is not internal // is already in the cache and the type is not internal

View File

@ -453,7 +453,7 @@ bool cmSetPropertyCommand::HandleCacheMode()
cmMakefile* mf = this->GetMakefile(); cmMakefile* mf = this->GetMakefile();
cmake* cm = mf->GetCMakeInstance(); cmake* cm = mf->GetCMakeInstance();
const char* existingValue const char* existingValue
= cm->GetCacheManager()->GetCacheEntryValue(*ni); = cm->GetState()->GetCacheEntryValue(*ni);
if(existingValue) if(existingValue)
{ {
if(!this->HandleCacheEntry(*ni)) if(!this->HandleCacheEntry(*ni))
@ -479,20 +479,19 @@ bool cmSetPropertyCommand::HandleCacheEntry(std::string const& cacheKey)
// Set or append the property. // Set or append the property.
const char* name = this->PropertyName.c_str(); const char* name = this->PropertyName.c_str();
const char* value = this->PropertyValue.c_str(); const char* value = this->PropertyValue.c_str();
cmCacheManager* manager = this->Makefile->GetCacheManager(); cmState* state = this->Makefile->GetState();
if (this->Remove) if (this->Remove)
{ {
manager->RemoveCacheEntryProperty(cacheKey, name); state->RemoveCacheEntryProperty(cacheKey, name);
return true;
} }
if(this->AppendMode) if(this->AppendMode)
{ {
manager->AppendCacheEntryProperty(cacheKey, name, value, state->AppendCacheEntryProperty(cacheKey, name, value,
this->AppendAsString); this->AppendAsString);
} }
else else
{ {
manager->SetCacheEntryProperty(cacheKey, name, value); state->SetCacheEntryProperty(cacheKey, name, value);
} }
return true; return true;

View File

@ -264,12 +264,12 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
comment.c_str(), comment.c_str(),
cmCacheManager::STRING); cmCacheManager::STRING);
cmCacheManager* manager = this->Makefile->GetCacheManager(); cmState* state = this->Makefile->GetState();
const char* existingValue const char* existingValue
= manager->GetCacheEntryValue(this->RunResultVariable); = state->GetCacheEntryValue(this->RunResultVariable);
if (existingValue) if (existingValue)
{ {
manager->SetCacheEntryProperty(this->RunResultVariable, "ADVANCED", "1"); state->SetCacheEntryProperty(this->RunResultVariable, "ADVANCED", "1");
} }
error = true; error = true;
@ -291,12 +291,12 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
"PLEASE_FILL_OUT-NOTFOUND", "PLEASE_FILL_OUT-NOTFOUND",
comment.c_str(), comment.c_str(),
cmCacheManager::STRING); cmCacheManager::STRING);
cmCacheManager* manager = this->Makefile->GetCacheManager(); cmState* state = this->Makefile->GetState();
const char* existing = const char* existing =
manager->GetCacheEntryValue(internalRunOutputName); state->GetCacheEntryValue(internalRunOutputName);
if (existing) if (existing)
{ {
manager->SetCacheEntryProperty(internalRunOutputName, state->SetCacheEntryProperty(internalRunOutputName,
"ADVANCED", "1"); "ADVANCED", "1");
} }

View File

@ -10,7 +10,7 @@
See the License for more information. See the License for more information.
============================================================================*/ ============================================================================*/
#include "cmVariableRequiresCommand.h" #include "cmVariableRequiresCommand.h"
#include "cmCacheManager.h" #include "cmState.h"
// cmLibraryCommand // cmLibraryCommand
bool cmVariableRequiresCommand bool cmVariableRequiresCommand
@ -34,6 +34,7 @@ bool cmVariableRequiresCommand
bool requirementsMet = true; bool requirementsMet = true;
std::string notSet; std::string notSet;
bool hasAdvanced = false; bool hasAdvanced = false;
cmState* state = this->Makefile->GetState();
for(unsigned int i = 2; i < args.size(); ++i) for(unsigned int i = 2; i < args.size(); ++i)
{ {
if(!this->Makefile->IsOn(args[i])) if(!this->Makefile->IsOn(args[i]))
@ -41,9 +42,8 @@ bool cmVariableRequiresCommand
requirementsMet = false; requirementsMet = false;
notSet += args[i]; notSet += args[i];
notSet += "\n"; notSet += "\n";
cmCacheManager* manager = this->Makefile->GetCacheManager(); if(state->GetCacheEntryValue(args[i]) &&
if(manager->GetCacheEntryValue(args[i]) && state->GetCacheEntryPropertyAsBool(args[i], "ADVANCED"))
manager->GetCacheEntryPropertyAsBool(args[i], "ADVANCED"))
{ {
hasAdvanced = true; hasAdvanced = true;
} }

View File

@ -348,22 +348,20 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
std::string cachedValue; std::string cachedValue;
if(this->WarnUnusedCli) if(this->WarnUnusedCli)
{ {
if(const char *v = this->CacheManager if(const char *v = this->State->GetInitializedCacheValue(var))
->GetInitializedCacheValue(var))
{ {
haveValue = true; haveValue = true;
cachedValue = v; cachedValue = v;
} }
} }
this->CacheManager->AddCacheEntry(var, value.c_str(), this->State->AddCacheEntry(var, value.c_str(),
"No help, variable specified on the command line.", type); "No help, variable specified on the command line.", type);
if(this->WarnUnusedCli) if(this->WarnUnusedCli)
{ {
if (!haveValue || if (!haveValue ||
cachedValue != this->CacheManager cachedValue != this->State->GetInitializedCacheValue(var))
->GetInitializedCacheValue(var))
{ {
this->WatchUnusedCli(var); this->WatchUnusedCli(var);
} }
@ -407,13 +405,11 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
cmsys::Glob::PatternToRegex(entryPattern, true, true).c_str()); cmsys::Glob::PatternToRegex(entryPattern, true, true).c_str());
//go through all cache entries and collect the vars which will be removed //go through all cache entries and collect the vars which will be removed
std::vector<std::string> entriesToDelete; std::vector<std::string> entriesToDelete;
std::vector<std::string> cacheKeys = std::vector<std::string> cacheKeys = this->State->GetCacheEntryKeys();
this->CacheManager->GetCacheEntryKeys();
for (std::vector<std::string>::const_iterator it = cacheKeys.begin(); for (std::vector<std::string>::const_iterator it = cacheKeys.begin();
it != cacheKeys.end(); ++it) it != cacheKeys.end(); ++it)
{ {
cmCacheManager::CacheEntryType t = cmCacheManager::CacheEntryType t = this->State->GetCacheEntryType(*it);
this->CacheManager->GetCacheEntryType(*it);
if(t != cmCacheManager::STATIC) if(t != cmCacheManager::STATIC)
{ {
if (regex.find(it->c_str())) if (regex.find(it->c_str()))
@ -429,7 +425,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
currentEntry != entriesToDelete.end(); currentEntry != entriesToDelete.end();
++currentEntry) ++currentEntry)
{ {
this->CacheManager->RemoveCacheEntry(*currentEntry); this->State->RemoveCacheEntry(*currentEntry);
} }
} }
else if(arg.find("-C",0) == 0) else if(arg.find("-C",0) == 0)
@ -925,7 +921,7 @@ void cmake::SetDirectoriesFromFile(const char* arg)
if(this->LoadCache(cachePath)) if(this->LoadCache(cachePath))
{ {
const char* existingValue = const char* existingValue =
this->CacheManager->GetCacheEntryValue("CMAKE_HOME_DIRECTORY"); this->State->GetCacheEntryValue("CMAKE_HOME_DIRECTORY");
if (existingValue) if (existingValue)
{ {
this->SetHomeOutputDirectory(cachePath); this->SetHomeOutputDirectory(cachePath);
@ -1255,7 +1251,6 @@ int cmake::HandleDeleteCacheVariables(const std::string& var)
{ {
return 0; return 0;
} }
cmCacheManager::CacheIterator ci = this->CacheManager->NewIterator();
std::vector<SaveCacheEntry> saved; std::vector<SaveCacheEntry> saved;
std::ostringstream warning; std::ostringstream warning;
warning warning
@ -1271,10 +1266,13 @@ int cmake::HandleDeleteCacheVariables(const std::string& var)
i++; i++;
save.value = *i; save.value = *i;
warning << *i << "\n"; warning << *i << "\n";
if(ci.Find(save.key)) const char* existingValue =
this->CacheManager->GetCacheEntryValue(save.key);
if(existingValue)
{ {
save.type = ci.GetType(); save.type = this->CacheManager->GetCacheEntryType(save.key);
if(const char* help = ci.GetProperty("HELPSTRING")) if(const char* help =
this->CacheManager->GetCacheEntryProperty(save.key, "HELPSTRING"))
{ {
save.help = help; save.help = help;
} }
@ -1556,49 +1554,51 @@ int cmake::ActualConfigure()
// project requires compatibility with CMake 2.4. We detect this // project requires compatibility with CMake 2.4. We detect this
// here by looking for the old CMAKE_BACKWARDS_COMPATIBILITY // here by looking for the old CMAKE_BACKWARDS_COMPATIBILITY
// variable created when CMP0001 is not set to NEW. // variable created when CMP0001 is not set to NEW.
if(this->GetCacheManager() if(this->State
->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")) ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))
{ {
if(!this->CacheManager->GetInitializedCacheValue("LIBRARY_OUTPUT_PATH")) if(!this->State->GetInitializedCacheValue("LIBRARY_OUTPUT_PATH"))
{ {
this->CacheManager->AddCacheEntry this->State->AddCacheEntry
("LIBRARY_OUTPUT_PATH", "", ("LIBRARY_OUTPUT_PATH", "",
"Single output directory for building all libraries.", "Single output directory for building all libraries.",
cmCacheManager::PATH); cmCacheManager::PATH);
} }
if(!this->CacheManager if(!this->State
->GetInitializedCacheValue("EXECUTABLE_OUTPUT_PATH")) ->GetInitializedCacheValue("EXECUTABLE_OUTPUT_PATH"))
{ {
this->CacheManager->AddCacheEntry this->State->AddCacheEntry
("EXECUTABLE_OUTPUT_PATH", "", ("EXECUTABLE_OUTPUT_PATH", "",
"Single output directory for building all executables.", "Single output directory for building all executables.",
cmCacheManager::PATH); cmCacheManager::PATH);
} }
} }
if(!this->CacheManager if(!this->State
->GetInitializedCacheValue("CMAKE_USE_RELATIVE_PATHS")) ->GetInitializedCacheValue("CMAKE_USE_RELATIVE_PATHS"))
{ {
this->CacheManager->AddCacheEntry this->State->AddCacheEntry
("CMAKE_USE_RELATIVE_PATHS", "OFF", ("CMAKE_USE_RELATIVE_PATHS", "OFF",
"If true, cmake will use relative paths in makefiles and projects.", "If true, cmake will use relative paths in makefiles and projects.",
cmCacheManager::BOOL); cmCacheManager::BOOL);
if (!this->CacheManager->GetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS", if (!this->State->GetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS",
"ADVANCED")) "ADVANCED"))
{ {
this->CacheManager->SetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS", this->State->SetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS",
"ADVANCED", "1"); "ADVANCED", "1");
} }
} }
if(cmSystemTools::GetFatalErrorOccured() && if(cmSystemTools::GetFatalErrorOccured())
(!this->CacheManager->GetInitializedCacheValue("CMAKE_MAKE_PROGRAM") || {
cmSystemTools::IsOff(this->CacheManager-> const char* makeProgram =
GetInitializedCacheValue("CMAKE_MAKE_PROGRAM")))) this->State->GetInitializedCacheValue("CMAKE_MAKE_PROGRAM");
if (!makeProgram || cmSystemTools::IsOff(makeProgram))
{ {
// We must have a bad generator selection. Wipe the cache entry so the // We must have a bad generator selection. Wipe the cache entry so the
// user can select another. // user can select another.
this->CacheManager->RemoveCacheEntry("CMAKE_GENERATOR"); this->State->RemoveCacheEntry("CMAKE_GENERATOR");
this->CacheManager->RemoveCacheEntry("CMAKE_EXTRA_GENERATOR"); this->State->RemoveCacheEntry("CMAKE_EXTRA_GENERATOR");
}
} }
cmMakefile* mf=this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile(); cmMakefile* mf=this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile();
@ -2204,7 +2204,7 @@ void cmake::TruncateOutputLog(const char* fname)
{ {
return; return;
} }
if ( !this->CacheManager->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR") ) if (!this->State->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR"))
{ {
cmSystemTools::RemoveFile(fullPath); cmSystemTools::RemoveFile(fullPath);
return; return;
@ -2321,8 +2321,7 @@ const char *cmake::GetProperty(const std::string& prop,
std::string output = ""; std::string output = "";
if ( prop == "CACHE_VARIABLES" ) if ( prop == "CACHE_VARIABLES" )
{ {
std::vector<std::string> cacheKeys = std::vector<std::string> cacheKeys = this->State->GetCacheEntryKeys();
this->CacheManager->GetCacheEntryKeys();
this->SetProperty("CACHE_VARIABLES", cmJoin(cacheKeys, ";").c_str()); this->SetProperty("CACHE_VARIABLES", cmJoin(cacheKeys, ";").c_str());
} }
else if ( prop == "COMMANDS" ) else if ( prop == "COMMANDS" )
@ -2475,7 +2474,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
// we have to find the module directory, so we can copy the files // we have to find the module directory, so we can copy the files
this->AddCMakePaths(); this->AddCMakePaths();
std::string modulesPath = std::string modulesPath =
this->CacheManager->GetInitializedCacheValue("CMAKE_ROOT"); this->State->GetInitializedCacheValue("CMAKE_ROOT");
modulesPath += "/Modules"; modulesPath += "/Modules";
std::string inFile = modulesPath; std::string inFile = modulesPath;
inFile += "/SystemInformation.cmake"; inFile += "/SystemInformation.cmake";
@ -2685,7 +2684,7 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
if(t == cmake::AUTHOR_WARNING) if(t == cmake::AUTHOR_WARNING)
{ {
// Allow suppression of these warnings. // Allow suppression of these warnings.
const char* suppress = this->CacheManager->GetCacheEntryValue( const char* suppress = this->State->GetCacheEntryValue(
"CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); "CMAKE_SUPPRESS_DEVELOPER_WARNINGS");
if(suppress && cmSystemTools::IsOn(suppress)) if(suppress && cmSystemTools::IsOn(suppress))
{ {
@ -2806,7 +2805,7 @@ int cmake::Build(const std::string& dir,
return 1; return 1;
} }
const char* cachedGenerator = const char* cachedGenerator =
this->CacheManager->GetCacheEntryValue("CMAKE_GENERATOR"); this->State->GetCacheEntryValue("CMAKE_GENERATOR");
if(!cachedGenerator) if(!cachedGenerator)
{ {
std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n"; std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n";
@ -2823,7 +2822,7 @@ int cmake::Build(const std::string& dir,
std::string output; std::string output;
std::string projName; std::string projName;
const char* cachedProjectName = const char* cachedProjectName =
this->CacheManager->GetCacheEntryValue("CMAKE_PROJECT_NAME"); this->State->GetCacheEntryValue("CMAKE_PROJECT_NAME");
if(!cachedProjectName) if(!cachedProjectName)
{ {
std::cerr << "Error: could not find CMAKE_PROJECT_NAME in Cache\n"; std::cerr << "Error: could not find CMAKE_PROJECT_NAME in Cache\n";
@ -2832,7 +2831,7 @@ int cmake::Build(const std::string& dir,
projName = cachedProjectName; projName = cachedProjectName;
bool verbose = false; bool verbose = false;
const char* cachedVerbose = const char* cachedVerbose =
this->CacheManager->GetCacheEntryValue("CMAKE_VERBOSE_MAKEFILE"); this->State->GetCacheEntryValue("CMAKE_VERBOSE_MAKEFILE");
if(cachedVerbose) if(cachedVerbose)
{ {
verbose = cmSystemTools::IsOn(cachedVerbose); verbose = cmSystemTools::IsOn(cachedVerbose);

View File

@ -18,6 +18,7 @@
#include "cmake.h" #include "cmake.h"
#include "cmcmd.h" #include "cmcmd.h"
#include "cmState.h"
#include "cmCacheManager.h" #include "cmCacheManager.h"
#include "cmListFileCache.h" #include "cmListFileCache.h"
#include "cmSourceFile.h" #include "cmSourceFile.h"
@ -330,28 +331,28 @@ int do_cmake(int ac, char const* const* av)
{ {
std::cout << "-- Cache values" << std::endl; std::cout << "-- Cache values" << std::endl;
std::vector<std::string> keys = std::vector<std::string> keys =
cm.GetCacheManager()->GetCacheEntryKeys(); cm.GetState()->GetCacheEntryKeys();
for (std::vector<std::string>::const_iterator it = keys.begin(); for (std::vector<std::string>::const_iterator it = keys.begin();
it != keys.end(); ++it) it != keys.end(); ++it)
{ {
cmCacheManager::CacheEntryType t = cmCacheManager::CacheEntryType t =
cm.GetCacheManager()->GetCacheEntryType(*it); cm.GetState()->GetCacheEntryType(*it);
if ( t != cmCacheManager::INTERNAL && t != cmCacheManager::STATIC && if ( t != cmCacheManager::INTERNAL && t != cmCacheManager::STATIC &&
t != cmCacheManager::UNINITIALIZED ) t != cmCacheManager::UNINITIALIZED )
{ {
const char* advancedProp = const char* advancedProp =
cm.GetCacheManager()->GetCacheEntryProperty(*it, "ADVANCED"); cm.GetState()->GetCacheEntryProperty(*it, "ADVANCED");
if ( list_all_cached || !advancedProp) if ( list_all_cached || !advancedProp)
{ {
if ( list_help ) if ( list_help )
{ {
std::cout << "// " std::cout << "// "
<< cm.GetCacheManager()->GetCacheEntryProperty(*it, << cm.GetState()->GetCacheEntryProperty(*it,
"HELPSTRING") << std::endl; "HELPSTRING") << std::endl;
} }
std::cout << *it << ":" << std::cout << *it << ":" <<
cmCacheManager::TypeToString(t) cmCacheManager::TypeToString(t)
<< "=" << cm.GetCacheManager()->GetCacheEntryValue(*it) << "=" << cm.GetState()->GetCacheEntryValue(*it)
<< std::endl; << std::endl;
if ( list_help ) if ( list_help )
{ {