diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-04-06 10:52:45 +0200 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-04-13 11:44:15 -0400 |
commit | ff7169a03c2ae2e7a0440c1f2921b7ce6b2e486c (patch) | |
tree | 5154d25dbe57edfed146b7d956487a7b1250b2ef /Source | |
parent | a6b1ad1309d14668e572da7937a2a8dda9e1f669 (diff) | |
download | cmake-ff7169a03c2ae2e7a0440c1f2921b7ce6b2e486c.tar.gz |
Port to cmState.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CursesDialog/ccmake.cxx | 1 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesCacheEntryComposite.cxx | 7 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesLongMessageForm.cxx | 1 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesMainForm.cxx | 47 | ||||
-rw-r--r-- | Source/QtDialog/QCMake.cxx | 36 | ||||
-rw-r--r-- | Source/cmCommandArgumentParserHelper.cxx | 3 | ||||
-rw-r--r-- | Source/cmExtraEclipseCDT4Generator.cxx | 3 | ||||
-rw-r--r-- | Source/cmFindBase.cxx | 9 | ||||
-rw-r--r-- | Source/cmGetPropertyCommand.cxx | 5 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 13 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 27 | ||||
-rw-r--r-- | Source/cmMarkAsAdvancedCommand.cxx | 12 | ||||
-rw-r--r-- | Source/cmOptionCommand.cxx | 8 | ||||
-rw-r--r-- | Source/cmSetCommand.cxx | 6 | ||||
-rw-r--r-- | Source/cmSetPropertyCommand.cxx | 13 | ||||
-rw-r--r-- | Source/cmTryRunCommand.cxx | 14 | ||||
-rw-r--r-- | Source/cmVariableRequiresCommand.cxx | 8 | ||||
-rw-r--r-- | Source/cmake.cxx | 83 | ||||
-rw-r--r-- | Source/cmakemain.cxx | 11 |
19 files changed, 156 insertions, 151 deletions
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index 3d92a2dfd6..e013f8167b 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -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" diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx index 4f028c42ad..4eb8e6cdce 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx @@ -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) { diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx index 057f8f3d86..67e4aab2b3 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.cxx +++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx @@ -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" diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 833d54038d..b067743c3b 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -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) diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 08d53ce271..775c11c38e 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -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(";"); diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index 99bf5f55fc..0d1c86dab6 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -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) diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 0d32e4bac2..675076946c 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -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 diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index cc080528d8..f10d545ed3 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -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)"; } diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 0e6e0c20e6..80edbcd225 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -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); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 35394b8f92..f6ec643dce 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -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) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index fefa648d46..ca50bc7c23 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -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 diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx index cc094b1bc3..66f1ebc7d8 100644 --- a/Source/cmMarkAsAdvancedCommand.cxx +++ b/Source/cmMarkAsAdvancedCommand.cxx @@ -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; diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index baf5b1e082..6c090def46 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -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; diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index e17474bd60..c636d530b4 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -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 diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index 77f9fb90b9..08de585ef1 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -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; diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index 911ade8105..3f766ab965 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -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"); } error = true; diff --git a/Source/cmVariableRequiresCommand.cxx b/Source/cmVariableRequiresCommand.cxx index dd2a682997..1d33db13c3 100644 --- a/Source/cmVariableRequiresCommand.cxx +++ b/Source/cmVariableRequiresCommand.cxx @@ -10,7 +10,7 @@ See the License for more information. ============================================================================*/ #include "cmVariableRequiresCommand.h" -#include "cmCacheManager.h" +#include "cmState.h" // cmLibraryCommand bool cmVariableRequiresCommand @@ -34,6 +34,7 @@ bool cmVariableRequiresCommand bool requirementsMet = true; std::string notSet; bool hasAdvanced = false; + cmState* state = this->Makefile->GetState(); for(unsigned int i = 2; i < args.size(); ++i) { if(!this->Makefile->IsOn(args[i])) @@ -41,9 +42,8 @@ bool cmVariableRequiresCommand requirementsMet = false; notSet += args[i]; notSet += "\n"; - cmCacheManager* manager = this->Makefile->GetCacheManager(); - if(manager->GetCacheEntryValue(args[i]) && - manager->GetCacheEntryPropertyAsBool(args[i], "ADVANCED")) + if(state->GetCacheEntryValue(args[i]) && + state->GetCacheEntryPropertyAsBool(args[i], "ADVANCED")) { hasAdvanced = true; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index c419edc76b..a337b2c3e5 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -348,22 +348,20 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) std::string cachedValue; if(this->WarnUnusedCli) { - if(const char *v = this->CacheManager - ->GetInitializedCacheValue(var)) + if(const char *v = this->State->GetInitializedCacheValue(var)) { haveValue = true; 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); if(this->WarnUnusedCli) { if (!haveValue || - cachedValue != this->CacheManager - ->GetInitializedCacheValue(var)) + cachedValue != this->State->GetInitializedCacheValue(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()); //go through all cache entries and collect the vars which will be removed std::vector<std::string> entriesToDelete; - std::vector<std::string> cacheKeys = - this->CacheManager->GetCacheEntryKeys(); + std::vector<std::string> cacheKeys = this->State->GetCacheEntryKeys(); for (std::vector<std::string>::const_iterator it = cacheKeys.begin(); it != cacheKeys.end(); ++it) { - cmCacheManager::CacheEntryType t = - this->CacheManager->GetCacheEntryType(*it); + cmCacheManager::CacheEntryType t = this->State->GetCacheEntryType(*it); if(t != cmCacheManager::STATIC) { if (regex.find(it->c_str())) @@ -429,7 +425,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) currentEntry != entriesToDelete.end(); ++currentEntry) { - this->CacheManager->RemoveCacheEntry(*currentEntry); + this->State->RemoveCacheEntry(*currentEntry); } } else if(arg.find("-C",0) == 0) @@ -925,7 +921,7 @@ void cmake::SetDirectoriesFromFile(const char* arg) if(this->LoadCache(cachePath)) { const char* existingValue = - this->CacheManager->GetCacheEntryValue("CMAKE_HOME_DIRECTORY"); + this->State->GetCacheEntryValue("CMAKE_HOME_DIRECTORY"); if (existingValue) { this->SetHomeOutputDirectory(cachePath); @@ -1255,7 +1251,6 @@ int cmake::HandleDeleteCacheVariables(const std::string& var) { return 0; } - cmCacheManager::CacheIterator ci = this->CacheManager->NewIterator(); std::vector<SaveCacheEntry> saved; std::ostringstream warning; warning @@ -1271,10 +1266,13 @@ int cmake::HandleDeleteCacheVariables(const std::string& var) i++; save.value = *i; warning << *i << "\n"; - if(ci.Find(save.key)) + const char* existingValue = + this->CacheManager->GetCacheEntryValue(save.key); + if(existingValue) { - save.type = ci.GetType(); - if(const char* help = ci.GetProperty("HELPSTRING")) + save.type = this->CacheManager->GetCacheEntryType(save.key); + if(const char* help = + this->CacheManager->GetCacheEntryProperty(save.key, "HELPSTRING")) { save.help = help; } @@ -1556,49 +1554,51 @@ 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() + if(this->State ->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", "", "Single output directory for building all libraries.", cmCacheManager::PATH); } - if(!this->CacheManager + if(!this->State ->GetInitializedCacheValue("EXECUTABLE_OUTPUT_PATH")) { - this->CacheManager->AddCacheEntry + this->State->AddCacheEntry ("EXECUTABLE_OUTPUT_PATH", "", "Single output directory for building all executables.", cmCacheManager::PATH); } } - if(!this->CacheManager + if(!this->State ->GetInitializedCacheValue("CMAKE_USE_RELATIVE_PATHS")) { - this->CacheManager->AddCacheEntry + this->State->AddCacheEntry ("CMAKE_USE_RELATIVE_PATHS", "OFF", "If true, cmake will use relative paths in makefiles and projects.", cmCacheManager::BOOL); - if (!this->CacheManager->GetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS", - "ADVANCED")) + if (!this->State->GetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS", + "ADVANCED")) { - this->CacheManager->SetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS", - "ADVANCED", "1"); + this->State->SetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS", + "ADVANCED", "1"); } } - if(cmSystemTools::GetFatalErrorOccured() && - (!this->CacheManager->GetInitializedCacheValue("CMAKE_MAKE_PROGRAM") || - cmSystemTools::IsOff(this->CacheManager-> - GetInitializedCacheValue("CMAKE_MAKE_PROGRAM")))) + if(cmSystemTools::GetFatalErrorOccured()) { - // We must have a bad generator selection. Wipe the cache entry so the - // user can select another. - this->CacheManager->RemoveCacheEntry("CMAKE_GENERATOR"); - this->CacheManager->RemoveCacheEntry("CMAKE_EXTRA_GENERATOR"); + const char* makeProgram = + this->State->GetInitializedCacheValue("CMAKE_MAKE_PROGRAM"); + if (!makeProgram || cmSystemTools::IsOff(makeProgram)) + { + // We must have a bad generator selection. Wipe the cache entry so the + // user can select another. + this->State->RemoveCacheEntry("CMAKE_GENERATOR"); + this->State->RemoveCacheEntry("CMAKE_EXTRA_GENERATOR"); + } } cmMakefile* mf=this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile(); @@ -2204,7 +2204,7 @@ void cmake::TruncateOutputLog(const char* fname) { return; } - if ( !this->CacheManager->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR") ) + if (!this->State->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR")) { cmSystemTools::RemoveFile(fullPath); return; @@ -2321,8 +2321,7 @@ const char *cmake::GetProperty(const std::string& prop, std::string output = ""; if ( prop == "CACHE_VARIABLES" ) { - std::vector<std::string> cacheKeys = - this->CacheManager->GetCacheEntryKeys(); + std::vector<std::string> cacheKeys = this->State->GetCacheEntryKeys(); this->SetProperty("CACHE_VARIABLES", cmJoin(cacheKeys, ";").c_str()); } 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 this->AddCMakePaths(); std::string modulesPath = - this->CacheManager->GetInitializedCacheValue("CMAKE_ROOT"); + this->State->GetInitializedCacheValue("CMAKE_ROOT"); modulesPath += "/Modules"; std::string inFile = modulesPath; inFile += "/SystemInformation.cmake"; @@ -2685,7 +2684,7 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text, if(t == cmake::AUTHOR_WARNING) { // Allow suppression of these warnings. - const char* suppress = this->CacheManager->GetCacheEntryValue( + const char* suppress = this->State->GetCacheEntryValue( "CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); if(suppress && cmSystemTools::IsOn(suppress)) { @@ -2806,7 +2805,7 @@ int cmake::Build(const std::string& dir, return 1; } const char* cachedGenerator = - this->CacheManager->GetCacheEntryValue("CMAKE_GENERATOR"); + this->State->GetCacheEntryValue("CMAKE_GENERATOR"); if(!cachedGenerator) { 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 projName; const char* cachedProjectName = - this->CacheManager->GetCacheEntryValue("CMAKE_PROJECT_NAME"); + this->State->GetCacheEntryValue("CMAKE_PROJECT_NAME"); if(!cachedProjectName) { 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; bool verbose = false; const char* cachedVerbose = - this->CacheManager->GetCacheEntryValue("CMAKE_VERBOSE_MAKEFILE"); + this->State->GetCacheEntryValue("CMAKE_VERBOSE_MAKEFILE"); if(cachedVerbose) { verbose = cmSystemTools::IsOn(cachedVerbose); diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 3b518be775..f678c6a4b6 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -18,6 +18,7 @@ #include "cmake.h" #include "cmcmd.h" +#include "cmState.h" #include "cmCacheManager.h" #include "cmListFileCache.h" #include "cmSourceFile.h" @@ -330,28 +331,28 @@ int do_cmake(int ac, char const* const* av) { std::cout << "-- Cache values" << std::endl; std::vector<std::string> keys = - cm.GetCacheManager()->GetCacheEntryKeys(); + cm.GetState()->GetCacheEntryKeys(); for (std::vector<std::string>::const_iterator it = keys.begin(); it != keys.end(); ++it) { cmCacheManager::CacheEntryType t = - cm.GetCacheManager()->GetCacheEntryType(*it); + cm.GetState()->GetCacheEntryType(*it); if ( t != cmCacheManager::INTERNAL && t != cmCacheManager::STATIC && t != cmCacheManager::UNINITIALIZED ) { const char* advancedProp = - cm.GetCacheManager()->GetCacheEntryProperty(*it, "ADVANCED"); + cm.GetState()->GetCacheEntryProperty(*it, "ADVANCED"); if ( list_all_cached || !advancedProp) { if ( list_help ) { std::cout << "// " - << cm.GetCacheManager()->GetCacheEntryProperty(*it, + << cm.GetState()->GetCacheEntryProperty(*it, "HELPSTRING") << std::endl; } std::cout << *it << ":" << cmCacheManager::TypeToString(t) - << "=" << cm.GetCacheManager()->GetCacheEntryValue(*it) + << "=" << cm.GetState()->GetCacheEntryValue(*it) << std::endl; if ( list_help ) { |