diff options
Diffstat (limited to 'Source')
50 files changed, 239 insertions, 266 deletions
diff --git a/Source/CursesDialog/cmCursesBoolWidget.cxx b/Source/CursesDialog/cmCursesBoolWidget.cxx index fd15b99..29d9cb2 100644 --- a/Source/CursesDialog/cmCursesBoolWidget.cxx +++ b/Source/CursesDialog/cmCursesBoolWidget.cxx @@ -16,7 +16,7 @@ cmCursesBoolWidget::cmCursesBoolWidget(int width, int height, int left, int top) : cmCursesWidget(width, height, left, top) { - this->Type = cmCacheManager::BOOL; + this->Type = cmState::BOOL; set_field_fore(this->Field, A_NORMAL); set_field_back(this->Field, A_STANDOUT); field_opts_off(this->Field, O_STATIC); diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx index 4eb8e6c..7e09242 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx @@ -55,7 +55,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( assert(value); switch (cm->GetState()->GetCacheEntryType(key)) { - case cmCacheManager::BOOL: + case cmState::BOOL: this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1); if (cmSystemTools::IsOn(value)) { @@ -66,15 +66,15 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( static_cast<cmCursesBoolWidget*>(this->Entry)->SetValueAsBool(false); } break; - case cmCacheManager::PATH: + case cmState::PATH: this->Entry = new cmCursesPathWidget(this->EntryWidth, 1, 1, 1); static_cast<cmCursesPathWidget*>(this->Entry)->SetString(value); break; - case cmCacheManager::FILEPATH: + case cmState::FILEPATH: this->Entry = new cmCursesFilePathWidget(this->EntryWidth, 1, 1, 1); static_cast<cmCursesFilePathWidget*>(this->Entry)->SetString(value); break; - case cmCacheManager::STRING: + case cmState::STRING: { const char* stringsProp = cm->GetState() ->GetCacheEntryProperty(key, "STRINGS"); @@ -99,7 +99,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( } break; } - case cmCacheManager::UNINITIALIZED: + case cmState::UNINITIALIZED: cmSystemTools::Error("Found an undefined variable: ", key.c_str()); break; diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.h b/Source/CursesDialog/cmCursesCacheEntryComposite.h index dc4ee4af..f280897 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.h +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.h @@ -12,7 +12,6 @@ #ifndef cmCursesCacheEntryComposite_h #define cmCursesCacheEntryComposite_h -#include "../cmCacheManager.h" #include "cmCursesLabelWidget.h" class cmCursesCacheEntryComposite diff --git a/Source/CursesDialog/cmCursesDummyWidget.cxx b/Source/CursesDialog/cmCursesDummyWidget.cxx index 60086a5..9801e4d 100644 --- a/Source/CursesDialog/cmCursesDummyWidget.cxx +++ b/Source/CursesDialog/cmCursesDummyWidget.cxx @@ -15,7 +15,7 @@ cmCursesDummyWidget::cmCursesDummyWidget(int width, int height, int left, int top) : cmCursesWidget(width, height, left, top) { - this->Type = cmCacheManager::INTERNAL; + this->Type = cmState::INTERNAL; } diff --git a/Source/CursesDialog/cmCursesFilePathWidget.cxx b/Source/CursesDialog/cmCursesFilePathWidget.cxx index 01db014..51ed670 100644 --- a/Source/CursesDialog/cmCursesFilePathWidget.cxx +++ b/Source/CursesDialog/cmCursesFilePathWidget.cxx @@ -15,6 +15,6 @@ cmCursesFilePathWidget::cmCursesFilePathWidget(int width, int height, int left, int top) : cmCursesPathWidget(width, height, left, top) { - this->Type = cmCacheManager::FILEPATH; + this->Type = cmState::FILEPATH; } diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index b067743..be17a9f 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.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 "../cmVersion.h" #include "../cmake.h" @@ -118,11 +117,11 @@ void cmCursesMainForm::InitializeUI() for(std::vector<std::string>::const_iterator it = cacheKeys.begin(); it != cacheKeys.end(); ++it) { - cmCacheManager::CacheEntryType t = this->CMakeInstance->GetState() + cmState::CacheEntryType t = this->CMakeInstance->GetState() ->GetCacheEntryType(*it); - if (t != cmCacheManager::INTERNAL && - t != cmCacheManager::STATIC && - t != cmCacheManager::UNINITIALIZED) + if (t != cmState::INTERNAL && + t != cmState::STATIC && + t != cmState::UNINITIALIZED) { ++count; } @@ -148,11 +147,11 @@ void cmCursesMainForm::InitializeUI() it != cacheKeys.end(); ++it) { std::string key = *it; - cmCacheManager::CacheEntryType t = this->CMakeInstance->GetState() + cmState::CacheEntryType t = this->CMakeInstance->GetState() ->GetCacheEntryType(*it); - if (t == cmCacheManager::INTERNAL || - t == cmCacheManager::STATIC || - t == cmCacheManager::UNINITIALIZED ) + if (t == cmState::INTERNAL || + t == cmState::STATIC || + t == cmState::UNINITIALIZED ) { continue; } @@ -172,11 +171,11 @@ void cmCursesMainForm::InitializeUI() it != cacheKeys.end(); ++it) { std::string key = *it; - cmCacheManager::CacheEntryType t = this->CMakeInstance->GetState() + cmState::CacheEntryType t = this->CMakeInstance->GetState() ->GetCacheEntryType(*it); - if (t == cmCacheManager::INTERNAL || - t == cmCacheManager::STATIC || - t == cmCacheManager::UNINITIALIZED ) + if (t == cmState::INTERNAL || + t == cmState::STATIC || + t == cmState::UNINITIALIZED ) { continue; } @@ -294,9 +293,9 @@ void cmCursesMainForm::Render(int left, int top, int width, int height) cmCursesWidget* cw = reinterpret_cast<cmCursesWidget*> (field_userptr(currentField)); // If in edit mode, get out of it - if ( cw->GetType() == cmCacheManager::STRING || - cw->GetType() == cmCacheManager::PATH || - cw->GetType() == cmCacheManager::FILEPATH ) + if ( cw->GetType() == cmState::STRING || + cw->GetType() == cmState::PATH || + cw->GetType() == cmState::FILEPATH ) { cmCursesStringWidget* sw = static_cast<cmCursesStringWidget*>(cw); sw->SetInEdit(false); @@ -823,7 +822,7 @@ void cmCursesMainForm::FillCacheManagerFromUI() std::string newValue = (*this->Entries)[i]->Entry->GetValue(); std::string fixedOldValue; std::string fixedNewValue; - cmCacheManager::CacheEntryType t = + cmState::CacheEntryType t = this->CMakeInstance->GetState() ->GetCacheEntryType(cacheKey); this->FixValue(t, oldValue, fixedOldValue); @@ -841,15 +840,15 @@ void cmCursesMainForm::FillCacheManagerFromUI() } } -void cmCursesMainForm::FixValue(cmCacheManager::CacheEntryType type, +void cmCursesMainForm::FixValue(cmState::CacheEntryType type, const std::string& in, std::string& out) const { out = in.substr(0,in.find_last_not_of(" ")+1); - if(type == cmCacheManager::PATH || type == cmCacheManager::FILEPATH) + if(type == cmState::PATH || type == cmState::FILEPATH) { cmSystemTools::ConvertToUnixSlashes(out); } - if(type == cmCacheManager::BOOL) + if(type == cmState::BOOL) { if(cmSystemTools::IsOff(out.c_str())) { diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h index 6455252..255c823 100644 --- a/Source/CursesDialog/cmCursesMainForm.h +++ b/Source/CursesDialog/cmCursesMainForm.h @@ -113,7 +113,7 @@ protected: // cache. void FillCacheManagerFromUI(); // Fix formatting of values to a consistent form. - void FixValue(cmCacheManager::CacheEntryType type, + void FixValue(cmState::CacheEntryType type, const std::string& in, std::string& out) const; // Re-post the existing fields. Used to toggle between // normal and advanced modes. Render() should be called diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx index 2f4b59e..30110a4 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.cxx +++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx @@ -21,7 +21,7 @@ cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height, int left, int top) : cmCursesWidget(width, height, left, top) { - this->Type = cmCacheManager::BOOL; // this is a bit of a hack + this->Type = cmState::BOOL; // this is a bit of a hack // there is no option type, and string type causes ccmake to cast // the widget into a string widget at some point. BOOL is safe for // now. diff --git a/Source/CursesDialog/cmCursesPathWidget.cxx b/Source/CursesDialog/cmCursesPathWidget.cxx index 89e2238..6116823 100644 --- a/Source/CursesDialog/cmCursesPathWidget.cxx +++ b/Source/CursesDialog/cmCursesPathWidget.cxx @@ -18,7 +18,7 @@ cmCursesPathWidget::cmCursesPathWidget(int width, int height, int left, int top) : cmCursesStringWidget(width, height, left, top) { - this->Type = cmCacheManager::PATH; + this->Type = cmState::PATH; this->Cycle = false; this->CurrentIndex = 0; } @@ -59,7 +59,7 @@ void cmCursesPathWidget::OnTab(cmCursesMainForm* fm, WINDOW* w) } std::vector<std::string> dirs; - cmSystemTools::SimpleGlob(glob, dirs, (this->Type == cmCacheManager::PATH?-1:0)); + cmSystemTools::SimpleGlob(glob, dirs, (this->Type == cmState::PATH?-1:0)); if ( this->CurrentIndex < dirs.size() ) { cstr = dirs[this->CurrentIndex]; diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx index d25022d..acf262f 100644 --- a/Source/CursesDialog/cmCursesStringWidget.cxx +++ b/Source/CursesDialog/cmCursesStringWidget.cxx @@ -22,7 +22,7 @@ cmCursesStringWidget::cmCursesStringWidget(int width, int height, cmCursesWidget(width, height, left, top) { this->InEdit = false; - this->Type = cmCacheManager::STRING; + this->Type = cmState::STRING; set_field_fore(this->Field, A_NORMAL); set_field_back(this->Field, A_STANDOUT); field_opts_off(this->Field, O_STATIC); diff --git a/Source/CursesDialog/cmCursesWidget.h b/Source/CursesDialog/cmCursesWidget.h index 7d82864..7bbdff1 100644 --- a/Source/CursesDialog/cmCursesWidget.h +++ b/Source/CursesDialog/cmCursesWidget.h @@ -12,7 +12,7 @@ #ifndef cmCursesWidget_h #define cmCursesWidget_h -#include "../cmCacheManager.h" +#include "../cmState.h" #include "cmCursesStandardIncludes.h" class cmCursesMainForm; @@ -46,7 +46,7 @@ public: /** * Get the type of the widget (STRING, PATH etc...) */ - cmCacheManager::CacheEntryType GetType() + cmState::CacheEntryType GetType() { return this->Type; } /** @@ -77,7 +77,7 @@ protected: cmCursesWidget(const cmCursesWidget& from); void operator=(const cmCursesWidget&); - cmCacheManager::CacheEntryType Type; + cmState::CacheEntryType Type; std::string Value; FIELD* Field; // The page in the main form this widget is in diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 775c11c..6524350 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -200,9 +200,9 @@ void QCMake::setProperties(const QCMakePropertyList& newProps) for(std::vector<std::string>::const_iterator it = cacheKeys.begin(); it != cacheKeys.end(); ++it) { - cmCacheManager::CacheEntryType t = state->GetCacheEntryType(*it); - if(t == cmCacheManager::INTERNAL || - t == cmCacheManager::STATIC) + cmState::CacheEntryType t = state->GetCacheEntryType(*it); + if(t == cmState::INTERNAL || + t == cmState::STATIC) { continue; } @@ -249,28 +249,28 @@ void QCMake::setProperties(const QCMakePropertyList& newProps) this->CMakeInstance->AddCacheEntry(s.Key.toLocal8Bit().data(), s.Value.toBool() ? "ON" : "OFF", s.Help.toLocal8Bit().data(), - cmCacheManager::BOOL); + cmState::BOOL); } else if(s.Type == QCMakeProperty::STRING) { this->CMakeInstance->AddCacheEntry(s.Key.toLocal8Bit().data(), s.Value.toString().toLocal8Bit().data(), s.Help.toLocal8Bit().data(), - cmCacheManager::STRING); + cmState::STRING); } else if(s.Type == QCMakeProperty::PATH) { this->CMakeInstance->AddCacheEntry(s.Key.toLocal8Bit().data(), s.Value.toString().toLocal8Bit().data(), s.Help.toLocal8Bit().data(), - cmCacheManager::PATH); + cmState::PATH); } else if(s.Type == QCMakeProperty::FILEPATH) { this->CMakeInstance->AddCacheEntry(s.Key.toLocal8Bit().data(), s.Value.toString().toLocal8Bit().data(), s.Help.toLocal8Bit().data(), - cmCacheManager::FILEPATH); + cmState::FILEPATH); } } @@ -286,10 +286,10 @@ QCMakePropertyList QCMake::properties() const for (std::vector<std::string>::const_iterator i = cacheKeys.begin(); i != cacheKeys.end(); ++i) { - cmCacheManager::CacheEntryType t = state->GetCacheEntryType(*i); - if(t == cmCacheManager::INTERNAL || - t == cmCacheManager::STATIC || - t == cmCacheManager::UNINITIALIZED) + cmState::CacheEntryType t = state->GetCacheEntryType(*i); + if(t == cmState::INTERNAL || + t == cmState::STATIC || + t == cmState::UNINITIALIZED) { continue; } @@ -302,20 +302,20 @@ QCMakePropertyList QCMake::properties() const state->GetCacheEntryProperty(*i, "HELPSTRING")); prop.Value = QString::fromLocal8Bit(cachedValue); prop.Advanced = state->GetCacheEntryPropertyAsBool(*i, "ADVANCED"); - if(t == cmCacheManager::BOOL) + if(t == cmState::BOOL) { prop.Type = QCMakeProperty::BOOL; prop.Value = cmSystemTools::IsOn(cachedValue); } - else if(t == cmCacheManager::PATH) + else if(t == cmState::PATH) { prop.Type = QCMakeProperty::PATH; } - else if(t == cmCacheManager::FILEPATH) + else if(t == cmState::FILEPATH) { prop.Type = QCMakeProperty::FILEPATH; } - else if(t == cmCacheManager::STRING) + else if(t == cmState::STRING) { prop.Type = QCMakeProperty::STRING; const char* stringsProperty = diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx index 5d32437..cdca792 100644 --- a/Source/cmBuildCommand.cxx +++ b/Source/cmBuildCommand.cxx @@ -147,6 +147,6 @@ bool cmBuildCommand makecommand.c_str(), "Command used to build entire project " "from the command line.", - cmCacheManager::STRING); + cmState::STRING); return true; } diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx index 171ed0f..2a06574 100644 --- a/Source/cmBuildNameCommand.cxx +++ b/Source/cmBuildNameCommand.cxx @@ -39,7 +39,7 @@ bool cmBuildNameCommand this->Makefile->AddCacheDefinition(args[0], cv.c_str(), "Name of build.", - cmCacheManager::STRING); + cmState::STRING); } return true; } @@ -74,7 +74,7 @@ bool cmBuildNameCommand this->Makefile->AddCacheDefinition(args[0], buildname.c_str(), "Name of build.", - cmCacheManager::STRING); + cmState::STRING); return true; } diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 987a7b1..5ae7d4c 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -87,27 +87,27 @@ void CCONV cmAddCacheDefinition(void *arg, const char* name, { case CM_CACHE_BOOL: mf->AddCacheDefinition(name,value,doc, - cmCacheManager::BOOL); + cmState::BOOL); break; case CM_CACHE_PATH: mf->AddCacheDefinition(name,value,doc, - cmCacheManager::PATH); + cmState::PATH); break; case CM_CACHE_FILEPATH: mf->AddCacheDefinition(name,value,doc, - cmCacheManager::FILEPATH); + cmState::FILEPATH); break; case CM_CACHE_STRING: mf->AddCacheDefinition(name,value,doc, - cmCacheManager::STRING); + cmState::STRING); break; case CM_CACHE_INTERNAL: mf->AddCacheDefinition(name,value,doc, - cmCacheManager::INTERNAL); + cmState::INTERNAL); break; case CM_CACHE_STATIC: mf->AddCacheDefinition(name,value,doc, - cmCacheManager::STATIC); + cmState::STATIC); break; } } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 1db057b..6715638 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2279,7 +2279,7 @@ bool cmCTest::AddVariableDefinition(const std::string &arg) { std::string name; std::string value; - cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED; + cmState::CacheEntryType type = cmState::UNINITIALIZED; if (cmake::ParseCacheEntry(arg, name, value, type)) { diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 5387d0c..289d0dc 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -22,17 +22,6 @@ #include <cmsys/FStream.hxx> #include <cmsys/RegularExpression.hxx> -const char* cmCacheManagerTypes[] = -{ "BOOL", - "PATH", - "FILEPATH", - "STRING", - "INTERNAL", - "STATIC", - "UNINITIALIZED", - 0 -}; - cmCacheManager::cmCacheManager(cmake* cm) { this->CacheMajorVersion = 0; @@ -40,41 +29,6 @@ cmCacheManager::cmCacheManager(cmake* cm) this->CMakeInstance = cm; } -const char* cmCacheManager::TypeToString(cmCacheManager::CacheEntryType type) -{ - if ( type > 6 ) - { - return cmCacheManagerTypes[6]; - } - return cmCacheManagerTypes[type]; -} - -cmCacheManager::CacheEntryType cmCacheManager::StringToType(const char* s) -{ - int i = 0; - while(cmCacheManagerTypes[i]) - { - if(strcmp(s, cmCacheManagerTypes[i]) == 0) - { - return static_cast<CacheEntryType>(i); - } - ++i; - } - return STRING; -} - -bool cmCacheManager::IsType(const char* s) -{ - for(int i=0; cmCacheManagerTypes[i]; ++i) - { - if(strcmp(s, cmCacheManagerTypes[i]) == 0) - { - return true; - } - } - return false; -} - bool cmCacheManager::LoadCache(const std::string& path) { std::set<std::string> emptySet; @@ -122,7 +76,7 @@ static bool ParseEntryWithoutType(const std::string& entry, bool cmCacheManager::ParseEntry(const std::string& entry, std::string& var, std::string& value, - CacheEntryType& type) + cmState::CacheEntryType& type) { // input line is: key:type=value static cmsys::RegularExpression reg( @@ -134,14 +88,14 @@ bool cmCacheManager::ParseEntry(const std::string& entry, if(regQuoted.find(entry)) { var = regQuoted.match(1); - type = cmCacheManager::StringToType(regQuoted.match(2).c_str()); + type = cmState::StringToCacheEntryType(regQuoted.match(2).c_str()); value = regQuoted.match(3); flag = true; } else if (reg.find(entry)) { var = reg.match(1); - type = cmCacheManager::StringToType(reg.match(2).c_str()); + type = cmState::StringToCacheEntryType(reg.match(2).c_str()); value = reg.match(3); flag = true; } @@ -250,7 +204,7 @@ bool cmCacheManager::LoadCache(const std::string& path, // If the entry is not internal to the cache being loaded // or if it is in the list of internal entries to be // imported, load it. - if ( internal || (e.Type != INTERNAL) || + if ( internal || (e.Type != cmState::INTERNAL) || (includes.find(entryKey) != includes.end()) ) { // If we are loading the cache from another project, @@ -258,7 +212,7 @@ bool cmCacheManager::LoadCache(const std::string& path, // not visible in the gui if (!internal) { - e.Type = INTERNAL; + e.Type = cmState::INTERNAL; helpString = "DO NOT EDIT, "; helpString += entryKey; helpString += " loaded from external file. " @@ -306,10 +260,10 @@ bool cmCacheManager::LoadCache(const std::string& path, // Set as version 0.0 this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", "0", "Minor version of cmake used to create the " - "current loaded cache", cmCacheManager::INTERNAL); + "current loaded cache", cmState::INTERNAL); this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", "0", "Major version of cmake used to create the " - "current loaded cache", cmCacheManager::INTERNAL); + "current loaded cache", cmState::INTERNAL); } // check to make sure the cache directory has not @@ -351,7 +305,7 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey, CacheEntry& e) { // All property entries are internal. - if(e.Type != cmCacheManager::INTERNAL) + if(e.Type != cmState::INTERNAL) { return false; } @@ -370,7 +324,7 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey, // Create an entry and store the property. CacheEntry& ne = this->Cache[key]; ne.Properties.SetCMakeInstance(this->CMakeInstance); - ne.Type = cmCacheManager::UNINITIALIZED; + ne.Type = cmState::UNINITIALIZED; ne.SetProperty(*p, e.Value.c_str()); } else @@ -427,15 +381,15 @@ bool cmCacheManager::SaveCache(const std::string& path) sprintf(temp, "%d", cmVersion::GetMinorVersion()); this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", temp, "Minor version of cmake used to create the " - "current loaded cache", cmCacheManager::INTERNAL); + "current loaded cache", cmState::INTERNAL); sprintf(temp, "%d", cmVersion::GetMajorVersion()); this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", temp, "Major version of cmake used to create the " - "current loaded cache", cmCacheManager::INTERNAL); + "current loaded cache", cmState::INTERNAL); sprintf(temp, "%d", cmVersion::GetPatchVersion()); this->AddCacheEntry("CMAKE_CACHE_PATCH_VERSION", temp, "Patch version of cmake used to create the " - "current loaded cache", cmCacheManager::INTERNAL); + "current loaded cache", cmState::INTERNAL); // Let us store the current working directory so that if somebody // Copies it, he will not be surprised @@ -450,7 +404,7 @@ bool cmCacheManager::SaveCache(const std::string& path) cmSystemTools::ConvertToUnixSlashes(currentcwd); this->AddCacheEntry("CMAKE_CACHEFILE_DIR", currentcwd.c_str(), "This is the directory where this CMakeCache.txt" - " was created", cmCacheManager::INTERNAL); + " was created", cmState::INTERNAL); fout << "# This is the CMakeCache file.\n" << "# For build in directory: " << currentcwd << "\n"; @@ -484,7 +438,7 @@ bool cmCacheManager::SaveCache(const std::string& path) this->Cache.begin(); i != this->Cache.end(); ++i) { const CacheEntry& ce = (*i).second; - CacheEntryType t = ce.Type; + cmState::CacheEntryType t = ce.Type; if(!ce.Initialized) { /* @@ -493,7 +447,7 @@ bool cmCacheManager::SaveCache(const std::string& path) "\" is uninitialized"); */ } - else if(t != INTERNAL) + else if(t != cmState::INTERNAL) { // Format is key:type=value if(const char* help = ce.GetProperty("HELPSTRING")) @@ -505,7 +459,7 @@ bool cmCacheManager::SaveCache(const std::string& path) cmCacheManager::OutputHelpString(fout, "Missing description"); } this->OutputKey(fout, i->first); - fout << ":" << cmCacheManagerTypes[t] << "="; + fout << ":" << cmState::CacheEntryTypeToString(t) << "="; this->OutputValue(fout, ce.Value); fout << "\n\n"; } @@ -525,9 +479,9 @@ bool cmCacheManager::SaveCache(const std::string& path) continue; } - CacheEntryType t = i.GetType(); + cmState::CacheEntryType t = i.GetType(); this->WritePropertyEntries(fout, i); - if(t == cmCacheManager::INTERNAL) + if(t == cmState::INTERNAL) { // Format is key:type=value if(const char* help = i.GetProperty("HELPSTRING")) @@ -535,7 +489,7 @@ bool cmCacheManager::SaveCache(const std::string& path) this->OutputHelpString(fout, help); } this->OutputKey(fout, i.GetName()); - fout << ":" << cmCacheManagerTypes[t] << "="; + fout << ":" << cmState::CacheEntryTypeToString(t) << "="; this->OutputValue(fout, i.GetValue()); fout << "\n"; } @@ -677,7 +631,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const for(std::map<std::string, CacheEntry>::const_iterator i = this->Cache.begin(); i != this->Cache.end(); ++i) { - if((*i).second.Type != INTERNAL) + if((*i).second.Type != cmState::INTERNAL) { out << (*i).first << " = " << (*i).second.Value << std::endl; @@ -693,7 +647,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const void cmCacheManager::AddCacheEntry(const std::string& key, const char* value, const char* helpString, - CacheEntryType type) + cmState::CacheEntryType type) { CacheEntry& e = this->Cache[key]; e.Properties.SetCMakeInstance(this->CMakeInstance); @@ -708,7 +662,7 @@ void cmCacheManager::AddCacheEntry(const std::string& key, } e.Type = type; // make sure we only use unix style paths - if(type == FILEPATH || type == PATH) + if(type == cmState::FILEPATH || type == cmState::PATH) { if(e.Value.find(';') != e.Value.npos) { @@ -789,7 +743,7 @@ cmCacheManager::CacheEntry::GetProperty(const std::string& prop) const { if(prop == "TYPE") { - return cmCacheManagerTypes[this->Type]; + return cmState::CacheEntryTypeToString(this->Type); } else if(prop == "VALUE") { @@ -806,7 +760,7 @@ void cmCacheManager::CacheEntry::SetProperty(const std::string& prop, { if(prop == "TYPE") { - this->Type = cmCacheManager::StringToType(value? value : "STRING"); + this->Type = cmState::StringToCacheEntryType(value? value : "STRING"); } else if(prop == "VALUE") { @@ -825,7 +779,7 @@ void cmCacheManager::CacheEntry::AppendProperty(const std::string& prop, { if(prop == "TYPE") { - this->Type = cmCacheManager::StringToType(value? value : "STRING"); + this->Type = cmState::StringToCacheEntryType(value? value : "STRING"); } else if(prop == "VALUE") { diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 00ae334..8462259 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -14,6 +14,8 @@ #include "cmStandardIncludes.h" #include "cmPropertyMap.h" +#include "cmState.h" + class cmMakefile; class cmMarkAsAdvancedCommand; class cmake; @@ -30,21 +32,22 @@ public: cmCacheManager(cmake* cm); class CacheIterator; friend class cmCacheManager::CacheIterator; - enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC, - UNINITIALIZED }; private: struct CacheEntry { std::string Value; - CacheEntryType Type; + cmState::CacheEntryType Type; cmPropertyMap Properties; const char* GetProperty(const std::string&) const; void SetProperty(const std::string& property, const char* value); void AppendProperty(const std::string& property, const char* value, bool asString=false); bool Initialized; - CacheEntry() : Value(""), Type(UNINITIALIZED), Initialized(false) + CacheEntry() + : Value(""), + Type(cmState::UNINITIALIZED), + Initialized(false) {} }; @@ -68,8 +71,10 @@ public: const char* GetValue() const { return this->GetEntry().Value.c_str(); } bool GetValueAsBool() const; void SetValue(const char*); - CacheEntryType GetType() const { return this->GetEntry().Type; } - void SetType(CacheEntryType ty) { this->GetEntry().Type = ty; } + cmState::CacheEntryType GetType() const + { return this->GetEntry().Type; } + void SetType(cmState::CacheEntryType ty) + { this->GetEntry().Type = ty; } bool Initialized() { return this->GetEntry().Initialized; } cmCacheManager &Container; std::map<std::string, CacheEntry>::iterator Position; @@ -94,17 +99,6 @@ public: return CacheIterator(*this); } - /** - * Types for the cache entries. These are useful as - * hints for a cache editor program. Path should bring - * up a file chooser, BOOL a check box, and STRING a - * text entry box, FILEPATH is a full path to a file which - * can be different than just a path input - */ - static CacheEntryType StringToType(const char*); - static const char* TypeToString(CacheEntryType); - static bool IsType(const char*); - ///! Load a cache for given makefile. Loads from path/CMakeCache.txt. bool LoadCache(const std::string& path); bool LoadCache(const std::string& path, bool internal, @@ -134,7 +128,7 @@ public: static bool ParseEntry(const std::string& entry, std::string& var, std::string& value, - CacheEntryType& type); + cmState::CacheEntryType& type); ///! Get a value from the cache given a key const char* GetInitializedCacheValue(const std::string& key) const; @@ -155,7 +149,7 @@ public: return this->GetCacheIterator(key.c_str()).GetProperty(propName); } - CacheEntryType GetCacheEntryType(std::string const& key) + cmState::CacheEntryType GetCacheEntryType(std::string const& key) { return this->GetCacheIterator(key.c_str()).GetType(); } @@ -223,7 +217,8 @@ public: protected: ///! Add an entry into the cache void AddCacheEntry(const std::string& key, const char* value, - const char* helpString, CacheEntryType type); + const char* helpString, + cmState::CacheEntryType type); ///! Get a cache entry object for a key CacheEntry *GetCacheEntry(const std::string& key); diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 59efa52..56a884c 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -11,7 +11,6 @@ ============================================================================*/ #include "cmCoreTryCompile.h" #include "cmake.h" -#include "cmCacheManager.h" #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" #include "cmAlgorithms.h" @@ -527,7 +526,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) this->Makefile->AddCacheDefinition(argv[0], (res == 0 ? "TRUE" : "FALSE"), "Result of TRY_COMPILE", - cmCacheManager::INTERNAL); + cmState::INTERNAL); if (!outputVariable.empty()) { diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 6750769..35b70e8 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -222,7 +222,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout, // in the cache valueToUse = envVarValue; mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(), - cacheEntryName.c_str(), cmCacheManager::STRING, + cacheEntryName.c_str(), cmState::STRING, true); mf->GetCMakeInstance()->SaveCache(mf->GetHomeOutputDirectory()); } @@ -243,7 +243,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout, { valueToUse = envVarValue; mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(), - cacheEntryName.c_str(), cmCacheManager::STRING, + cacheEntryName.c_str(), cmState::STRING, true); mf->GetCMakeInstance()->SaveCache(mf->GetHomeOutputDirectory()); } diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index f10d545..add06a7 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -378,7 +378,7 @@ bool cmFindBase::CheckForVariableInCache() // original value. Tell the subclass implementations to do // this. if(cached && state->GetCacheEntryType(this->VariableName) - == cmCacheManager::UNINITIALIZED) + == cmState::UNINITIALIZED) { this->AlreadyInCacheWithoutMetaInfo = true; } diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index c499f61..ef8340b 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -10,7 +10,6 @@ See the License for more information. ============================================================================*/ #include "cmFindLibraryCommand.h" -#include "cmCacheManager.h" #include <cmsys/Directory.hxx> #include <cmsys/stl/algorithm> @@ -39,7 +38,7 @@ bool cmFindLibraryCommand { this->Makefile->AddCacheDefinition(this->VariableName, "", this->VariableDocumentation.c_str(), - cmCacheManager::FILEPATH); + cmState::FILEPATH); } return true; } @@ -72,14 +71,14 @@ bool cmFindLibraryCommand this->Makefile->AddCacheDefinition(this->VariableName, library.c_str(), this->VariableDocumentation.c_str(), - cmCacheManager::FILEPATH); + cmState::FILEPATH); return true; } std::string notfound = this->VariableName + "-NOTFOUND"; this->Makefile->AddCacheDefinition(this->VariableName, notfound.c_str(), this->VariableDocumentation.c_str(), - cmCacheManager::FILEPATH); + cmState::FILEPATH); return true; } diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 4d7fd60..b32f5fd 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -947,7 +947,7 @@ bool cmFindPackageCommand::FindConfig() // We force the value since we do not get here if it was already set. this->Makefile->AddCacheDefinition(this->Variable, init.c_str(), help.c_str(), - cmCacheManager::PATH, true); + cmState::PATH, true); return found; } diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx index 49fbf45..1f3d1a4 100644 --- a/Source/cmFindPathCommand.cxx +++ b/Source/cmFindPathCommand.cxx @@ -10,7 +10,6 @@ See the License for more information. ============================================================================*/ #include "cmFindPathCommand.h" -#include "cmCacheManager.h" #include <cmsys/Glob.hxx> @@ -41,7 +40,7 @@ bool cmFindPathCommand this->VariableName, "", this->VariableDocumentation.c_str(), (this->IncludeFileInPath ? - cmCacheManager::FILEPATH :cmCacheManager::PATH) + cmState::FILEPATH :cmState::PATH) ); } return true; @@ -54,7 +53,7 @@ bool cmFindPathCommand (this->VariableName, result.c_str(), this->VariableDocumentation.c_str(), (this->IncludeFileInPath) ? - cmCacheManager::FILEPATH :cmCacheManager::PATH); + cmState::FILEPATH :cmState::PATH); return true; } this->Makefile->AddCacheDefinition @@ -62,7 +61,7 @@ bool cmFindPathCommand (this->VariableName + "-NOTFOUND").c_str(), this->VariableDocumentation.c_str(), (this->IncludeFileInPath) ? - cmCacheManager::FILEPATH :cmCacheManager::PATH); + cmState::FILEPATH :cmState::PATH); return true; } diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx index 4ee419c..fbd9fd3 100644 --- a/Source/cmFindProgramCommand.cxx +++ b/Source/cmFindProgramCommand.cxx @@ -10,7 +10,6 @@ See the License for more information. ============================================================================*/ #include "cmFindProgramCommand.h" -#include "cmCacheManager.h" #include <stdlib.h> #if defined(__APPLE__) @@ -37,7 +36,7 @@ bool cmFindProgramCommand { this->Makefile->AddCacheDefinition(this->VariableName, "", this->VariableDocumentation.c_str(), - cmCacheManager::FILEPATH); + cmState::FILEPATH); } return true; } @@ -49,14 +48,14 @@ bool cmFindProgramCommand this->Makefile->AddCacheDefinition(this->VariableName, result.c_str(), this->VariableDocumentation.c_str(), - cmCacheManager::FILEPATH); + cmState::FILEPATH); return true; } this->Makefile->AddCacheDefinition(this->VariableName, (this->VariableName + "-NOTFOUND").c_str(), this->VariableDocumentation.c_str(), - cmCacheManager::FILEPATH); + cmState::FILEPATH); return true; } diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx index 9aceb39..6947a7f 100644 --- a/Source/cmGetFilenameComponentCommand.cxx +++ b/Source/cmGetFilenameComponentCommand.cxx @@ -117,13 +117,13 @@ bool cmGetFilenameComponentCommand { this->Makefile->AddCacheDefinition (storeArgs, programArgs.c_str(), - "", args[2] == "PATH" ? cmCacheManager::FILEPATH - : cmCacheManager::STRING); + "", args[2] == "PATH" ? cmState::FILEPATH + : cmState::STRING); } this->Makefile->AddCacheDefinition (args[0], result.c_str(), "", - args[2] == "PATH" ? cmCacheManager::FILEPATH - : cmCacheManager::STRING); + args[2] == "PATH" ? cmState::FILEPATH + : cmState::STRING); } else { diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index f6ec643..4a93446 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -311,7 +311,7 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf) makeProgram += saveFile; mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", makeProgram.c_str(), "make program", - cmCacheManager::FILEPATH); + cmState::FILEPATH); } } @@ -1116,7 +1116,7 @@ void cmGlobalGenerator::Configure() sprintf(num,"%d",static_cast<int>(this->LocalGenerators.size())); this->GetCMakeInstance()->AddCacheEntry ("CMAKE_NUMBER_OF_LOCAL_GENERATORS", num, - "number of local generators", cmCacheManager::INTERNAL); + "number of local generators", cmState::INTERNAL); // check for link libraries and include directories containing "NOTFOUND" // and for infinite loops @@ -1894,7 +1894,7 @@ void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen, gen->GetCMakeInstance()->GetCacheDefinition("CMAKE_MAKE_PROGRAM"); this->GetCMakeInstance()->AddCacheEntry("CMAKE_MAKE_PROGRAM", make, "make program", - cmCacheManager::FILEPATH); + cmState::FILEPATH); // copy the enabled languages this->LanguageEnabled = gen->LanguageEnabled; this->LanguagesReady = gen->LanguagesReady; diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 7648813..22d633c 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -97,7 +97,7 @@ std::string cmGlobalUnixMakefileGenerator3::GetEditCacheCommand() const { cm->AddCacheEntry ("CMAKE_EDIT_COMMAND", editCacheCommand.c_str(), - "Path to cache edit program executable.", cmCacheManager::INTERNAL); + "Path to cache edit program executable.", cmState::INTERNAL); } } const char* edit_cmd = cm->GetCacheDefinition("CMAKE_EDIT_COMMAND"); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 0e0e63a..6a3a145 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -89,7 +89,7 @@ void cmGlobalVisualStudio7Generator "Semicolon separated list of supported configuration types, " "only supports Debug, Release, MinSizeRel, and RelWithDebInfo, " "anything else will be ignored.", - cmCacheManager::STRING); + cmState::STRING); } // Create list of configurations requested by user's cache, if any. @@ -109,7 +109,7 @@ void cmGlobalVisualStudio7Generator mf->AddCacheDefinition ("CMAKE_MSVCIDE_RUN_PATH", extraPath, "Saved environment variable CMAKE_MSVCIDE_RUN_PATH", - cmCacheManager::STATIC); + cmState::STATIC); } } @@ -335,7 +335,7 @@ void cmGlobalVisualStudio7Generator::GenerateConfigurations(cmMakefile* mf) "Semicolon separated list of supported configuration types, " "only supports Debug, Release, MinSizeRel, and RelWithDebInfo, " "anything else will be ignored.", - cmCacheManager::STRING); + cmState::STRING); } void cmGlobalVisualStudio7Generator::Generate() @@ -970,7 +970,7 @@ void cmGlobalVisualStudio7Generator::CreateGUID(const std::string& name) ret = cmSystemTools::UpperCase(ret); this->CMakeInstance->AddCacheEntry(guidStoreName.c_str(), ret.c_str(), "Stored GUID", - cmCacheManager::INTERNAL); + cmState::INTERNAL); } std::vector<std::string> *cmGlobalVisualStudio7Generator::GetConfigurations() diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 0561a05..7488386 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -285,7 +285,7 @@ void cmGlobalXCodeGenerator::EnableLanguage(std::vector<std::string>const& "Semicolon separated list of supported configuration types, " "only supports Debug, Release, MinSizeRel, and RelWithDebInfo, " "anything else will be ignored.", - cmCacheManager::STRING); + cmState::STRING); } } mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); @@ -2754,7 +2754,7 @@ std::string cmGlobalXCodeGenerator::GetOrCreateId(const std::string& name, } this->CMakeInstance->AddCacheEntry(guidStoreName.c_str(), - id.c_str(), "Stored Xcode object GUID", cmCacheManager::INTERNAL); + id.c_str(), "Stored Xcode object GUID", cmState::INTERNAL); return id; } diff --git a/Source/cmIncludeExternalMSProjectCommand.cxx b/Source/cmIncludeExternalMSProjectCommand.cxx index d40d8fe..1e7258a 100644 --- a/Source/cmIncludeExternalMSProjectCommand.cxx +++ b/Source/cmIncludeExternalMSProjectCommand.cxx @@ -73,7 +73,7 @@ bool cmIncludeExternalMSProjectCommand std::string guidVariable = utility_name + "_GUID_CMAKE"; this->Makefile->GetCMakeInstance()->AddCacheEntry( guidVariable.c_str(), customGuid.c_str(), - "Stored GUID", cmCacheManager::INTERNAL); + "Stored GUID", cmState::INTERNAL); } // Create a target instance for this utility. diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx index e2ae901..6ade535 100644 --- a/Source/cmLoadCacheCommand.cxx +++ b/Source/cmLoadCacheCommand.cxx @@ -172,7 +172,7 @@ void cmLoadCacheCommand::CheckLine(const char* line) // Check one line of the cache file. std::string var; std::string value; - cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED; + cmState::CacheEntryType type = cmState::UNINITIALIZED; if(cmake::ParseCacheEntry(line, var, value, type)) { // Found a real entry. See if this one was requested. diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index aa70ab9..2b67562 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -118,7 +118,7 @@ void cmLocalVisualStudio10Generator AddCacheEntry(guidStoreName.c_str(), parser.GUID.c_str(), "Stored GUID", - cmCacheManager::INTERNAL); + cmState::INTERNAL); } //---------------------------------------------------------------------------- diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index c4abeb2..884212b 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -16,7 +16,6 @@ #include "cmMakefile.h" #include "cmSystemTools.h" #include "cmSourceFile.h" -#include "cmCacheManager.h" #include "cmGeneratorTarget.h" #include "cmCustomCommandGenerator.h" #include "cmake.h" @@ -2331,7 +2330,7 @@ void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID( AddCacheEntry(guidStoreName.c_str(), parser.GUID.c_str(), "Stored GUID", - cmCacheManager::INTERNAL); + cmState::INTERNAL); } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 94e4695..6aa5224 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -18,7 +18,6 @@ #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmCommands.h" -#include "cmCacheManager.h" #include "cmState.h" #include "cmFunctionBlocker.h" #include "cmListFileCache.h" @@ -1806,7 +1805,7 @@ void cmMakefile::AddDefinition(const std::string& name, const char* value) void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, const char* doc, - cmCacheManager::CacheEntryType type, + cmState::CacheEntryType type, bool force) { bool haveVal = value ? true : false; @@ -1815,7 +1814,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, this->GetState()->GetInitializedCacheValue(name); if(existingValue && (this->GetState()->GetCacheEntryType(name) - == cmCacheManager::UNINITIALIZED)) + == cmState::UNINITIALIZED)) { // if this is not a force, then use the value from the cache // if it is a force, then use the value being passed in @@ -1824,7 +1823,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, val = existingValue; haveVal = true; } - if ( type == cmCacheManager::PATH || type == cmCacheManager::FILEPATH ) + if ( type == cmState::PATH || type == cmState::FILEPATH ) { std::vector<std::string>::size_type cc; std::vector<std::string> files; @@ -3617,7 +3616,7 @@ int cmMakefile::TryCompile(const std::string& srcdir, // Add this before the user-provided CMake arguments in case // one of the arguments is -DCMAKE_BUILD_TYPE=... cm.AddCacheEntry("CMAKE_BUILD_TYPE", config, - "Build configuration", cmCacheManager::STRING); + "Build configuration", cmState::STRING); } } // if cmake args were provided then pass them in @@ -3656,12 +3655,12 @@ int cmMakefile::TryCompile(const std::string& srcdir, if(this->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS")) { cm.AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", - "TRUE", "", cmCacheManager::INTERNAL); + "TRUE", "", cmState::INTERNAL); } else { cm.AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", - "FALSE", "", cmCacheManager::INTERNAL); + "FALSE", "", cmState::INTERNAL); } if (cm.Configure() != 0) { @@ -4914,7 +4913,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, "For backwards compatibility, what version of CMake " "commands and " "syntax should this version of CMake try to support.", - cmCacheManager::STRING); + cmState::STRING); } } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index fad31d1..da92ad7 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -22,6 +22,7 @@ #include "cmGeneratorTarget.h" #include "cmExpandedCommandArgument.h" #include "cmake.h" +#include "cmState.h" #if defined(CMAKE_BUILD_WITH_CMAKE) #include "cmSourceGroup.h" @@ -305,7 +306,7 @@ public: ///! Add a definition to this makefile and the global cmake cache. void AddCacheDefinition(const std::string& name, const char* value, const char* doc, - cmCacheManager::CacheEntryType type, + cmState::CacheEntryType type, bool force = false); /** diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx index 66f1ebc..10d30f3 100644 --- a/Source/cmMarkAsAdvancedCommand.cxx +++ b/Source/cmMarkAsAdvancedCommand.cxx @@ -39,7 +39,7 @@ bool cmMarkAsAdvancedCommand cmState* state = this->Makefile->GetState(); if (!state->GetCacheEntryValue(variable)) { - state->AddCacheEntry(variable, 0, 0, cmCacheManager::UNINITIALIZED); + state->AddCacheEntry(variable, 0, 0, cmState::UNINITIALIZED); overwrite = true; } if (!state->GetCacheEntryValue(variable)) diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index 6c090de..92be5f1 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -46,7 +46,7 @@ bool cmOptionCommand const char* existingValue = state->GetCacheEntryValue(args[0]); if(existingValue) { - if (state->GetCacheEntryType(args[0]) != cmCacheManager::UNINITIALIZED) + if (state->GetCacheEntryType(args[0]) != cmState::UNINITIALIZED) { state->SetCacheEntryProperty(args[0], "HELPSTRING", args[1]); return true; @@ -59,6 +59,6 @@ bool cmOptionCommand } bool init = cmSystemTools::IsOn(initialValue.c_str()); this->Makefile->AddCacheDefinition(args[0], init? "ON":"OFF", - args[1].c_str(), cmCacheManager::BOOL); + args[1].c_str(), cmState::BOOL); return true; } diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index 61c0133..601dc54 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -30,11 +30,11 @@ bool cmProjectCommand this->Makefile->AddCacheDefinition (bindir, this->Makefile->GetCurrentOutputDirectory(), - "Value Computed by CMake", cmCacheManager::STATIC); + "Value Computed by CMake", cmState::STATIC); this->Makefile->AddCacheDefinition (srcdir, this->Makefile->GetCurrentDirectory(), - "Value Computed by CMake", cmCacheManager::STATIC); + "Value Computed by CMake", cmState::STATIC); bindir = "PROJECT_BINARY_DIR"; srcdir = "PROJECT_SOURCE_DIR"; @@ -59,7 +59,7 @@ bool cmProjectCommand this->Makefile->AddCacheDefinition ("CMAKE_PROJECT_NAME", args[0].c_str(), - "Value Computed by CMake", cmCacheManager::STATIC); + "Value Computed by CMake", cmState::STATIC); } bool haveVersion = false; diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index c636d53..bf9f42c 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -79,8 +79,8 @@ bool cmSetCommand bool cache = false; // optional bool force = false; // optional bool parentScope = false; - cmCacheManager::CacheEntryType type - = cmCacheManager::STRING; // required if cache + cmState::CacheEntryType type + = cmState::STRING; // required if cache const char* docstring = 0; // required if cache unsigned int ignoreLastArgs = 0; @@ -131,7 +131,7 @@ bool cmSetCommand if(cache) { std::string::size_type cacheStart = args.size() - 3 - (force ? 1 : 0); - type = cmCacheManager::StringToType(args[cacheStart+1].c_str()); + type = cmState::StringToCacheEntryType(args[cacheStart+1].c_str()); docstring = args[cacheStart+2].c_str(); } @@ -139,13 +139,13 @@ bool cmSetCommand cmState* state = this->Makefile->GetState(); const char* existingValue = state->GetCacheEntryValue(variable); if(existingValue && - (state->GetCacheEntryType(variable) != cmCacheManager::UNINITIALIZED)) + (state->GetCacheEntryType(variable) != cmState::UNINITIALIZED)) { // if the set is trying to CACHE the value but the value // is already in the cache and the type is not internal // then leave now without setting any definitions in the cache // or the makefile - if(cache && type != cmCacheManager::INTERNAL && !force) + if(cache && type != cmState::INTERNAL && !force) { return true; } diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index 08de585..bb94a72 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -14,7 +14,6 @@ #include "cmSetTestsPropertiesCommand.h" #include "cmSetSourceFilesPropertiesCommand.h" -#include "cmCacheManager.h" //---------------------------------------------------------------------------- cmSetPropertyCommand::cmSetPropertyCommand() @@ -426,7 +425,7 @@ bool cmSetPropertyCommand::HandleCacheMode() } else if(this->PropertyName == "TYPE") { - if(!cmCacheManager::IsType(this->PropertyValue.c_str())) + if(!cmState::IsCacheEntryType(this->PropertyValue.c_str())) { std::ostringstream e; e << "given invalid CACHE entry TYPE \"" << this->PropertyValue << "\""; diff --git a/Source/cmSiteNameCommand.cxx b/Source/cmSiteNameCommand.cxx index 927888b..20a61a0 100644 --- a/Source/cmSiteNameCommand.cxx +++ b/Source/cmSiteNameCommand.cxx @@ -88,7 +88,7 @@ bool cmSiteNameCommand AddCacheDefinition(args[0], siteName.c_str(), "Name of the computer/site where compile is being run", - cmCacheManager::STRING); + cmState::STRING); return true; } diff --git a/Source/cmState.cxx b/Source/cmState.cxx index f5e3752..7602f63 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -12,26 +12,59 @@ #include "cmState.h" #include "cmake.h" +#include "cmCacheManager.h" cmState::cmState(cmake* cm) : CMakeInstance(cm) { } -cmCacheManager::CacheEntryType -cmState::StringToCacheEntryType(const char* s) + +const char* cmCacheEntryTypes[] = +{ "BOOL", + "PATH", + "FILEPATH", + "STRING", + "INTERNAL", + "STATIC", + "UNINITIALIZED", + 0 +}; + +const char* +cmState::CacheEntryTypeToString(cmState::CacheEntryType type) { - return cmCacheManager::StringToType(s); + if ( type > 6 ) + { + return cmCacheEntryTypes[6]; + } + return cmCacheEntryTypes[type]; } -const char* -cmState::CacheEntryTypeToString(cmCacheManager::CacheEntryType t) +cmState::CacheEntryType +cmState::StringToCacheEntryType(const char* s) { - return cmCacheManager::TypeToString(t); + int i = 0; + while(cmCacheEntryTypes[i]) + { + if(strcmp(s, cmCacheEntryTypes[i]) == 0) + { + return static_cast<cmState::CacheEntryType>(i); + } + ++i; + } + return STRING; } bool cmState::IsCacheEntryType(std::string const& key) { - return cmCacheManager::IsType(key.c_str()); + for(int i=0; cmCacheEntryTypes[i]; ++i) + { + if(strcmp(key.c_str(), cmCacheEntryTypes[i]) == 0) + { + return true; + } + } + return false; } std::vector<std::string> cmState::GetCacheEntryKeys() const @@ -64,7 +97,7 @@ cmState::GetInitializedCacheValue(std::string const& key) const return this->CMakeInstance->GetCacheManager()->GetInitializedCacheValue(key); } -cmCacheManager::CacheEntryType +cmState::CacheEntryType cmState::GetCacheEntryType(std::string const& key) const { cmCacheManager::CacheIterator it = @@ -117,7 +150,7 @@ bool cmState::GetCacheEntryPropertyAsBool(std::string const& key, void cmState::AddCacheEntry(const std::string& key, const char* value, const char* helpString, - cmCacheManager::CacheEntryType type) + cmState::CacheEntryType type) { this->CMakeInstance->GetCacheManager()->AddCacheEntry(key, value, helpString, type); diff --git a/Source/cmState.h b/Source/cmState.h index 06b0ec6..f2e8ef5 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -12,7 +12,7 @@ #ifndef cmState_h #define cmState_h -#include "cmCacheManager.h" +#include "cmStandardIncludes.h" class cmake; @@ -21,21 +21,21 @@ class cmState public: cmState(cmake* cm); - static cmCacheManager::CacheEntryType StringToCacheEntryType(const char*); - static const char* CacheEntryTypeToString(cmCacheManager::CacheEntryType); + enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC, + UNINITIALIZED }; + static CacheEntryType StringToCacheEntryType(const char*); + static const char* CacheEntryTypeToString(CacheEntryType); static bool IsCacheEntryType(std::string const& key); std::vector<std::string> GetCacheEntryKeys() const; const char* GetCacheEntryValue(std::string const& key) const; const char* GetInitializedCacheValue(std::string const& key) const; - cmCacheManager::CacheEntryType - GetCacheEntryType(std::string const& key) const; + CacheEntryType GetCacheEntryType(std::string const& key) const; void SetCacheEntryValue(std::string const& key, std::string const& value); void SetCacheValue(std::string const& key, std::string const& value); void AddCacheEntry(const std::string& key, const char* value, - const char* helpString, - cmCacheManager::CacheEntryType type); + const char* helpString, CacheEntryType type); void RemoveCacheEntry(std::string const& key); void SetCacheEntryProperty(std::string const& key, diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index b3d1155..1702a7d 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1181,7 +1181,7 @@ void cmTarget::ClearDependencyInformation( cmMakefile& mf, if (this->RecordDependencies) { mf.AddCacheDefinition(depname, "", - "Dependencies for target", cmCacheManager::STATIC); + "Dependencies for target", cmState::STATIC); } else { @@ -1369,7 +1369,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, dependencies += ";"; mf.AddCacheDefinition( targetEntry, dependencies.c_str(), "Dependencies for the target", - cmCacheManager::STATIC ); + cmState::STATIC ); } } diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index 3f766ab..bcc4a83 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -10,7 +10,6 @@ See the License for more information. ============================================================================*/ #include "cmTryRunCommand.h" -#include "cmCacheManager.h" #include "cmTryCompileCommand.h" #include <cmsys/FStream.hxx> @@ -217,7 +216,7 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs, } this->Makefile->AddCacheDefinition(this->RunResultVariable, retChar, "Result of TRY_RUN", - cmCacheManager::INTERNAL); + cmState::INTERNAL); } /* This is only used when cross compiling. Instead of running the @@ -262,7 +261,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, this->Makefile->AddCacheDefinition(this->RunResultVariable, "PLEASE_FILL_OUT-FAILED_TO_RUN", comment.c_str(), - cmCacheManager::STRING); + cmState::STRING); cmState* state = this->Makefile->GetState(); const char* existingValue @@ -290,7 +289,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, this->Makefile->AddCacheDefinition(internalRunOutputName, "PLEASE_FILL_OUT-NOTFOUND", comment.c_str(), - cmCacheManager::STRING); + cmState::STRING); cmState* state = this->Makefile->GetState(); const char* existing = state->GetCacheEntryValue(internalRunOutputName); diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx index 2799a9b..10122e9 100644 --- a/Source/cmUtilitySourceCommand.cxx +++ b/Source/cmUtilitySourceCommand.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmUtilitySourceCommand.h" +#include "cmCacheManager.h" + // cmUtilitySourceCommand bool cmUtilitySourceCommand ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) @@ -118,14 +120,14 @@ bool cmUtilitySourceCommand this->Makefile->AddCacheDefinition(cacheEntry, utilityExecutable.c_str(), "Path to an internal program.", - cmCacheManager::FILEPATH); + cmState::FILEPATH); // add a value into the cache that maps from the // full path to the name of the project cmSystemTools::ConvertToUnixSlashes(utilityExecutable); this->Makefile->AddCacheDefinition(utilityExecutable, utilityName.c_str(), "Executable to project name.", - cmCacheManager::INTERNAL); + cmState::INTERNAL); return true; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index a337b2c..b1eea98 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -338,7 +338,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) } } std::string var, value; - cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED; + cmState::CacheEntryType type = cmState::UNINITIALIZED; if(cmCacheManager::ParseEntry(entry, var, value, type)) { // The value is transformed if it is a filepath for example, so @@ -409,8 +409,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) for (std::vector<std::string>::const_iterator it = cacheKeys.begin(); it != cacheKeys.end(); ++it) { - cmCacheManager::CacheEntryType t = this->State->GetCacheEntryType(*it); - if(t != cmCacheManager::STATIC) + cmState::CacheEntryType t = this->State->GetCacheEntryType(*it); + if(t != cmState::STATIC) { if (regex.find(it->c_str())) { @@ -975,14 +975,14 @@ int cmake::AddCMakePaths() // Save the value in the cache this->CacheManager->AddCacheEntry ("CMAKE_COMMAND", cmSystemTools::GetCMakeCommand().c_str(), - "Path to CMake executable.", cmCacheManager::INTERNAL); + "Path to CMake executable.", cmState::INTERNAL); #ifdef CMAKE_BUILD_WITH_CMAKE this->CacheManager->AddCacheEntry ("CMAKE_CTEST_COMMAND", cmSystemTools::GetCTestCommand().c_str(), - "Path to ctest program executable.", cmCacheManager::INTERNAL); + "Path to ctest program executable.", cmState::INTERNAL); this->CacheManager->AddCacheEntry ("CMAKE_CPACK_COMMAND", cmSystemTools::GetCPackCommand().c_str(), - "Path to cpack program executable.", cmCacheManager::INTERNAL); + "Path to cpack program executable.", cmState::INTERNAL); #endif if(!cmSystemTools::FileExists( (cmSystemTools::GetCMakeRoot()+"/Modules/CMake.cmake").c_str())) @@ -996,7 +996,7 @@ int cmake::AddCMakePaths() } this->CacheManager->AddCacheEntry ("CMAKE_ROOT", cmSystemTools::GetCMakeRoot().c_str(), - "Path to CMake installation.", cmCacheManager::INTERNAL); + "Path to CMake installation.", cmState::INTERNAL); return 1; } @@ -1238,7 +1238,7 @@ struct SaveCacheEntry std::string key; std::string value; std::string help; - cmCacheManager::CacheEntryType type; + cmState::CacheEntryType type; }; int cmake::HandleDeleteCacheVariables(const std::string& var) @@ -1311,7 +1311,7 @@ int cmake::Configure() AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "TRUE", "Suppress Warnings that are meant for" " the author of the CMakeLists.txt files.", - cmCacheManager::INTERNAL); + cmState::INTERNAL); } else { @@ -1319,7 +1319,7 @@ int cmake::Configure() AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "FALSE", "Suppress Warnings that are meant for" " the author of the CMakeLists.txt files.", - cmCacheManager::INTERNAL); + cmState::INTERNAL); } } int ret = this->ActualConfigure(); @@ -1355,7 +1355,7 @@ int cmake::ActualConfigure() this->GetHomeDirectory(), "Start directory with the top level CMakeLists.txt file for this " "project", - cmCacheManager::INTERNAL); + cmState::INTERNAL); } // no generator specified on the command line @@ -1464,11 +1464,11 @@ int cmake::ActualConfigure() this->CacheManager->AddCacheEntry("CMAKE_GENERATOR", this->GlobalGenerator->GetName().c_str(), "Name of generator.", - cmCacheManager::INTERNAL); + cmState::INTERNAL); this->CacheManager->AddCacheEntry("CMAKE_EXTRA_GENERATOR", this->GlobalGenerator->GetExtraGeneratorName().c_str(), "Name of external makefile project generator.", - cmCacheManager::INTERNAL); + cmState::INTERNAL); } if(const char* platformName = @@ -1496,7 +1496,7 @@ int cmake::ActualConfigure() this->CacheManager->AddCacheEntry("CMAKE_GENERATOR_PLATFORM", this->GeneratorPlatform.c_str(), "Name of generator platform.", - cmCacheManager::INTERNAL); + cmState::INTERNAL); } if(const char* tsName = @@ -1524,7 +1524,7 @@ int cmake::ActualConfigure() this->CacheManager->AddCacheEntry("CMAKE_GENERATOR_TOOLSET", this->GeneratorToolset.c_str(), "Name of generator toolset.", - cmCacheManager::INTERNAL); + cmState::INTERNAL); } // reset any system configuration information, except for when we are @@ -1562,7 +1562,7 @@ int cmake::ActualConfigure() this->State->AddCacheEntry ("LIBRARY_OUTPUT_PATH", "", "Single output directory for building all libraries.", - cmCacheManager::PATH); + cmState::PATH); } if(!this->State ->GetInitializedCacheValue("EXECUTABLE_OUTPUT_PATH")) @@ -1570,7 +1570,7 @@ int cmake::ActualConfigure() this->State->AddCacheEntry ("EXECUTABLE_OUTPUT_PATH", "", "Single output directory for building all executables.", - cmCacheManager::PATH); + cmState::PATH); } } if(!this->State @@ -1579,7 +1579,7 @@ int cmake::ActualConfigure() this->State->AddCacheEntry ("CMAKE_USE_RELATIVE_PATHS", "OFF", "If true, cmake will use relative paths in makefiles and projects.", - cmCacheManager::BOOL); + cmState::BOOL); if (!this->State->GetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS", "ADVANCED")) { @@ -1804,7 +1804,7 @@ void cmake::AddCacheEntry(const std::string& key, const char* value, { this->CacheManager->AddCacheEntry(key, value, helpString, - cmCacheManager::CacheEntryType(type)); + cmState::CacheEntryType(type)); } const char* cmake::GetCacheDefinition(const std::string& name) const @@ -1876,7 +1876,7 @@ void cmake::AddDefaultGenerators() bool cmake::ParseCacheEntry(const std::string& entry, std::string& var, std::string& value, - cmCacheManager::CacheEntryType& type) + cmState::CacheEntryType& type) { return cmCacheManager::ParseEntry(entry, var, value, type); } diff --git a/Source/cmake.h b/Source/cmake.h index 0b24ed6..bbeb95d 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -19,6 +19,7 @@ #include "cmPropertyMap.h" #include "cmInstalledFile.h" #include "cmCacheManager.h" +#include "cmState.h" class cmGlobalGeneratorFactory; class cmGlobalGenerator; @@ -178,7 +179,7 @@ class cmake static bool ParseCacheEntry(const std::string& entry, std::string& var, std::string& value, - cmCacheManager::CacheEntryType& type); + cmState::CacheEntryType& type); int LoadCache(); bool LoadCache(const std::string& path); diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index f678c6a..c8cf2d4 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -19,7 +19,6 @@ #include "cmake.h" #include "cmcmd.h" #include "cmState.h" -#include "cmCacheManager.h" #include "cmListFileCache.h" #include "cmSourceFile.h" #include "cmGlobalGenerator.h" @@ -330,15 +329,13 @@ int do_cmake(int ac, char const* const* av) if ( list_cached || list_all_cached ) { std::cout << "-- Cache values" << std::endl; - std::vector<std::string> keys = - cm.GetState()->GetCacheEntryKeys(); + std::vector<std::string> keys = cm.GetState()->GetCacheEntryKeys(); for (std::vector<std::string>::const_iterator it = keys.begin(); it != keys.end(); ++it) { - cmCacheManager::CacheEntryType t = - cm.GetState()->GetCacheEntryType(*it); - if ( t != cmCacheManager::INTERNAL && t != cmCacheManager::STATIC && - t != cmCacheManager::UNINITIALIZED ) + cmState::CacheEntryType t = cm.GetState()->GetCacheEntryType(*it); + if (t != cmState::INTERNAL && t != cmState::STATIC && + t != cmState::UNINITIALIZED) { const char* advancedProp = cm.GetState()->GetCacheEntryProperty(*it, "ADVANCED"); @@ -351,7 +348,7 @@ int do_cmake(int ac, char const* const* av) "HELPSTRING") << std::endl; } std::cout << *it << ":" << - cmCacheManager::TypeToString(t) + cmState::CacheEntryTypeToString(t) << "=" << cm.GetState()->GetCacheEntryValue(*it) << std::endl; if ( list_help ) |