diff options
author | Stephen Kelly <steveire@gmail.com> | 2016-10-18 19:28:47 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2016-10-19 13:40:58 (GMT) |
commit | 2fe3e55d53989c909be595b00a4749b75886accf (patch) | |
tree | 2e4c856f1f992f20acc39659901a28ef6b7ec98a | |
parent | a49751fb2eed0ca6415b243c35b23201b8060597 (diff) | |
download | CMake-2fe3e55d53989c909be595b00a4749b75886accf.zip CMake-2fe3e55d53989c909be595b00a4749b75886accf.tar.gz CMake-2fe3e55d53989c909be595b00a4749b75886accf.tar.bz2 |
cmState: Move CacheEntryType enum to separate namespace
Port dependent code to the change.
50 files changed, 211 insertions, 191 deletions
diff --git a/Source/CursesDialog/cmCursesBoolWidget.cxx b/Source/CursesDialog/cmCursesBoolWidget.cxx index 5268a5d..3b81c65 100644 --- a/Source/CursesDialog/cmCursesBoolWidget.cxx +++ b/Source/CursesDialog/cmCursesBoolWidget.cxx @@ -11,7 +11,7 @@ cmCursesBoolWidget::cmCursesBoolWidget(int width, int height, int left, int top) : cmCursesWidget(width, height, left, top) { - this->Type = cmState::BOOL; + this->Type = cmStateEnums::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 93785e0..46c0d0c 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx @@ -47,7 +47,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( const char* value = cm->GetState()->GetCacheEntryValue(key); assert(value); switch (cm->GetState()->GetCacheEntryType(key)) { - case cmState::BOOL: + case cmStateEnums::BOOL: this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1); if (cmSystemTools::IsOn(value)) { static_cast<cmCursesBoolWidget*>(this->Entry)->SetValueAsBool(true); @@ -55,15 +55,15 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( static_cast<cmCursesBoolWidget*>(this->Entry)->SetValueAsBool(false); } break; - case cmState::PATH: + case cmStateEnums::PATH: this->Entry = new cmCursesPathWidget(this->EntryWidth, 1, 1, 1); static_cast<cmCursesPathWidget*>(this->Entry)->SetString(value); break; - case cmState::FILEPATH: + case cmStateEnums::FILEPATH: this->Entry = new cmCursesFilePathWidget(this->EntryWidth, 1, 1, 1); static_cast<cmCursesFilePathWidget*>(this->Entry)->SetString(value); break; - case cmState::STRING: { + case cmStateEnums::STRING: { const char* stringsProp = cm->GetState()->GetCacheEntryProperty(key, "STRINGS"); if (stringsProp) { @@ -83,7 +83,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( } break; } - case cmState::UNINITIALIZED: + case cmStateEnums::UNINITIALIZED: cmSystemTools::Error("Found an undefined variable: ", key.c_str()); break; default: diff --git a/Source/CursesDialog/cmCursesDummyWidget.cxx b/Source/CursesDialog/cmCursesDummyWidget.cxx index 61d07e2..b5a1daa 100644 --- a/Source/CursesDialog/cmCursesDummyWidget.cxx +++ b/Source/CursesDialog/cmCursesDummyWidget.cxx @@ -9,7 +9,7 @@ cmCursesDummyWidget::cmCursesDummyWidget(int width, int height, int left, int top) : cmCursesWidget(width, height, left, top) { - this->Type = cmState::INTERNAL; + this->Type = cmStateEnums::INTERNAL; } bool cmCursesDummyWidget::HandleInput(int& /*key*/, cmCursesMainForm* /*fm*/, diff --git a/Source/CursesDialog/cmCursesFilePathWidget.cxx b/Source/CursesDialog/cmCursesFilePathWidget.cxx index 670c50f..ee5f2d7 100644 --- a/Source/CursesDialog/cmCursesFilePathWidget.cxx +++ b/Source/CursesDialog/cmCursesFilePathWidget.cxx @@ -9,5 +9,5 @@ cmCursesFilePathWidget::cmCursesFilePathWidget(int width, int height, int left, int top) : cmCursesPathWidget(width, height, left, top) { - this->Type = cmState::FILEPATH; + this->Type = cmStateEnums::FILEPATH; } diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 0c3d29d..0db0200 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -106,10 +106,10 @@ void cmCursesMainForm::InitializeUI() for (std::vector<std::string>::const_iterator it = cacheKeys.begin(); it != cacheKeys.end(); ++it) { - cmState::CacheEntryType t = + cmStateEnums::CacheEntryType t = this->CMakeInstance->GetState()->GetCacheEntryType(*it); - if (t != cmState::INTERNAL && t != cmState::STATIC && - t != cmState::UNINITIALIZED) { + if (t != cmStateEnums::INTERNAL && t != cmStateEnums::STATIC && + t != cmStateEnums::UNINITIALIZED) { ++count; } } @@ -130,10 +130,10 @@ void cmCursesMainForm::InitializeUI() for (std::vector<std::string>::const_iterator it = cacheKeys.begin(); it != cacheKeys.end(); ++it) { std::string key = *it; - cmState::CacheEntryType t = + cmStateEnums::CacheEntryType t = this->CMakeInstance->GetState()->GetCacheEntryType(*it); - if (t == cmState::INTERNAL || t == cmState::STATIC || - t == cmState::UNINITIALIZED) { + if (t == cmStateEnums::INTERNAL || t == cmStateEnums::STATIC || + t == cmStateEnums::UNINITIALIZED) { continue; } @@ -148,10 +148,10 @@ void cmCursesMainForm::InitializeUI() for (std::vector<std::string>::const_iterator it = cacheKeys.begin(); it != cacheKeys.end(); ++it) { std::string key = *it; - cmState::CacheEntryType t = + cmStateEnums::CacheEntryType t = this->CMakeInstance->GetState()->GetCacheEntryType(*it); - if (t == cmState::INTERNAL || t == cmState::STATIC || - t == cmState::UNINITIALIZED) { + if (t == cmStateEnums::INTERNAL || t == cmStateEnums::STATIC || + t == cmStateEnums::UNINITIALIZED) { continue; } @@ -249,8 +249,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() == cmState::STRING || cw->GetType() == cmState::PATH || - cw->GetType() == cmState::FILEPATH) { + if (cw->GetType() == cmStateEnums::STRING || + cw->GetType() == cmStateEnums::PATH || + cw->GetType() == cmStateEnums::FILEPATH) { cmCursesStringWidget* sw = static_cast<cmCursesStringWidget*>(cw); sw->SetInEdit(false); } @@ -704,7 +705,7 @@ void cmCursesMainForm::FillCacheManagerFromUI() std::string newValue = (*this->Entries)[i]->Entry->GetValue(); std::string fixedOldValue; std::string fixedNewValue; - cmState::CacheEntryType t = + cmStateEnums::CacheEntryType t = this->CMakeInstance->GetState()->GetCacheEntryType(cacheKey); this->FixValue(t, oldValue, fixedOldValue); this->FixValue(t, newValue, fixedNewValue); @@ -720,14 +721,14 @@ void cmCursesMainForm::FillCacheManagerFromUI() } } -void cmCursesMainForm::FixValue(cmState::CacheEntryType type, +void cmCursesMainForm::FixValue(cmStateEnums::CacheEntryType type, const std::string& in, std::string& out) const { out = in.substr(0, in.find_last_not_of(' ') + 1); - if (type == cmState::PATH || type == cmState::FILEPATH) { + if (type == cmStateEnums::PATH || type == cmStateEnums::FILEPATH) { cmSystemTools::ConvertToUnixSlashes(out); } - if (type == cmState::BOOL) { + if (type == cmStateEnums::BOOL) { if (cmSystemTools::IsOff(out.c_str())) { out = "OFF"; } else { diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h index 4bf452d..10ae960 100644 --- a/Source/CursesDialog/cmCursesMainForm.h +++ b/Source/CursesDialog/cmCursesMainForm.h @@ -110,7 +110,7 @@ protected: // cache. void FillCacheManagerFromUI(); // Fix formatting of values to a consistent form. - void FixValue(cmState::CacheEntryType type, const std::string& in, + void FixValue(cmStateEnums::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 e23a82d..1b752a6 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.cxx +++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx @@ -11,7 +11,7 @@ cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height, int left, int top) : cmCursesWidget(width, height, left, top) { - this->Type = cmState::BOOL; // this is a bit of a hack + this->Type = cmStateEnums::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 d208598..3f96436 100644 --- a/Source/CursesDialog/cmCursesPathWidget.cxx +++ b/Source/CursesDialog/cmCursesPathWidget.cxx @@ -13,7 +13,7 @@ cmCursesPathWidget::cmCursesPathWidget(int width, int height, int left, int top) : cmCursesStringWidget(width, height, left, top) { - this->Type = cmState::PATH; + this->Type = cmStateEnums::PATH; this->Cycle = false; this->CurrentIndex = 0; } @@ -50,7 +50,7 @@ void cmCursesPathWidget::OnTab(cmCursesMainForm* fm, WINDOW* w) std::vector<std::string> dirs; cmSystemTools::SimpleGlob(glob, dirs, - (this->Type == cmState::PATH ? -1 : 0)); + (this->Type == cmStateEnums::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 f068f67..0f67d23 100644 --- a/Source/CursesDialog/cmCursesStringWidget.cxx +++ b/Source/CursesDialog/cmCursesStringWidget.cxx @@ -21,7 +21,7 @@ cmCursesStringWidget::cmCursesStringWidget(int width, int height, int left, : cmCursesWidget(width, height, left, top) { this->InEdit = false; - this->Type = cmState::STRING; + this->Type = cmStateEnums::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 bb26cf6..1ef4ab2 100644 --- a/Source/CursesDialog/cmCursesWidget.h +++ b/Source/CursesDialog/cmCursesWidget.h @@ -41,7 +41,7 @@ public: /** * Get the type of the widget (STRING, PATH etc...) */ - cmState::CacheEntryType GetType() { return this->Type; } + cmStateEnums::CacheEntryType GetType() { return this->Type; } /** * If there are any, print the widget specific commands @@ -62,7 +62,7 @@ protected: cmCursesWidget(const cmCursesWidget& from); void operator=(const cmCursesWidget&); - cmState::CacheEntryType Type; + cmStateEnums::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 cfb10f3..abeff97 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -196,8 +196,8 @@ void QCMake::setProperties(const QCMakePropertyList& newProps) std::vector<std::string> cacheKeys = state->GetCacheEntryKeys(); for (std::vector<std::string>::const_iterator it = cacheKeys.begin(); it != cacheKeys.end(); ++it) { - cmState::CacheEntryType t = state->GetCacheEntryType(*it); - if (t == cmState::INTERNAL || t == cmState::STATIC) { + cmStateEnums::CacheEntryType t = state->GetCacheEntryType(*it); + if (t == cmStateEnums::INTERNAL || t == cmStateEnums::STATIC) { continue; } @@ -232,19 +232,19 @@ void QCMake::setProperties(const QCMakePropertyList& newProps) if (s.Type == QCMakeProperty::BOOL) { this->CMakeInstance->AddCacheEntry( s.Key.toLocal8Bit().data(), s.Value.toBool() ? "ON" : "OFF", - s.Help.toLocal8Bit().data(), cmState::BOOL); + s.Help.toLocal8Bit().data(), cmStateEnums::BOOL); } else if (s.Type == QCMakeProperty::STRING) { this->CMakeInstance->AddCacheEntry( s.Key.toLocal8Bit().data(), s.Value.toString().toLocal8Bit().data(), - s.Help.toLocal8Bit().data(), cmState::STRING); + s.Help.toLocal8Bit().data(), cmStateEnums::STRING); } else if (s.Type == QCMakeProperty::PATH) { this->CMakeInstance->AddCacheEntry( s.Key.toLocal8Bit().data(), s.Value.toString().toLocal8Bit().data(), - s.Help.toLocal8Bit().data(), cmState::PATH); + s.Help.toLocal8Bit().data(), cmStateEnums::PATH); } else if (s.Type == QCMakeProperty::FILEPATH) { this->CMakeInstance->AddCacheEntry( s.Key.toLocal8Bit().data(), s.Value.toString().toLocal8Bit().data(), - s.Help.toLocal8Bit().data(), cmState::FILEPATH); + s.Help.toLocal8Bit().data(), cmStateEnums::FILEPATH); } } @@ -259,9 +259,9 @@ QCMakePropertyList QCMake::properties() const std::vector<std::string> cacheKeys = state->GetCacheEntryKeys(); for (std::vector<std::string>::const_iterator i = cacheKeys.begin(); i != cacheKeys.end(); ++i) { - cmState::CacheEntryType t = state->GetCacheEntryType(*i); - if (t == cmState::INTERNAL || t == cmState::STATIC || - t == cmState::UNINITIALIZED) { + cmStateEnums::CacheEntryType t = state->GetCacheEntryType(*i); + if (t == cmStateEnums::INTERNAL || t == cmStateEnums::STATIC || + t == cmStateEnums::UNINITIALIZED) { continue; } @@ -273,14 +273,14 @@ QCMakePropertyList QCMake::properties() const QString::fromLocal8Bit(state->GetCacheEntryProperty(*i, "HELPSTRING")); prop.Value = QString::fromLocal8Bit(cachedValue); prop.Advanced = state->GetCacheEntryPropertyAsBool(*i, "ADVANCED"); - if (t == cmState::BOOL) { + if (t == cmStateEnums::BOOL) { prop.Type = QCMakeProperty::BOOL; prop.Value = cmSystemTools::IsOn(cachedValue); - } else if (t == cmState::PATH) { + } else if (t == cmStateEnums::PATH) { prop.Type = QCMakeProperty::PATH; - } else if (t == cmState::FILEPATH) { + } else if (t == cmStateEnums::FILEPATH) { prop.Type = QCMakeProperty::FILEPATH; - } else if (t == cmState::STRING) { + } else if (t == cmStateEnums::STRING) { prop.Type = QCMakeProperty::STRING; const char* stringsProperty = state->GetCacheEntryProperty(*i, "STRINGS"); diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx index 365a426..8aa4102 100644 --- a/Source/cmBuildCommand.cxx +++ b/Source/cmBuildCommand.cxx @@ -116,6 +116,6 @@ bool cmBuildCommand::TwoArgsSignature(std::vector<std::string> const& args) this->Makefile->AddCacheDefinition(define, makecommand.c_str(), "Command used to build entire project " "from the command line.", - cmState::STRING); + cmStateEnums::STRING); return true; } diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx index 9134b9a..816147b 100644 --- a/Source/cmBuildNameCommand.cxx +++ b/Source/cmBuildNameCommand.cxx @@ -27,7 +27,7 @@ bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args, std::replace(cv.begin(), cv.end(), '(', '_'); std::replace(cv.begin(), cv.end(), ')', '_'); this->Makefile->AddCacheDefinition(args[0], cv.c_str(), "Name of build.", - cmState::STRING); + cmStateEnums::STRING); } return true; } @@ -53,6 +53,6 @@ bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args, std::replace(buildname.begin(), buildname.end(), ')', '_'); this->Makefile->AddCacheDefinition(args[0], buildname.c_str(), - "Name of build.", cmState::STRING); + "Name of build.", cmStateEnums::STRING); return true; } diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx index eea76f2..36ffd7c 100644 --- a/Source/cmCMakePolicyCommand.cxx +++ b/Source/cmCMakePolicyCommand.cxx @@ -79,7 +79,7 @@ bool cmCMakePolicyCommand::HandleSetMode(std::vector<std::string> const& args) "For backwards compatibility, what version of CMake " "commands and " "syntax should this version of CMake try to support.", - cmState::STRING); + cmStateEnums::STRING); } } return true; diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 98e18ed..155456a 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -75,22 +75,22 @@ void CCONV cmAddCacheDefinition(void* arg, const char* name, const char* value, switch (type) { case CM_CACHE_BOOL: - mf->AddCacheDefinition(name, value, doc, cmState::BOOL); + mf->AddCacheDefinition(name, value, doc, cmStateEnums::BOOL); break; case CM_CACHE_PATH: - mf->AddCacheDefinition(name, value, doc, cmState::PATH); + mf->AddCacheDefinition(name, value, doc, cmStateEnums::PATH); break; case CM_CACHE_FILEPATH: - mf->AddCacheDefinition(name, value, doc, cmState::FILEPATH); + mf->AddCacheDefinition(name, value, doc, cmStateEnums::FILEPATH); break; case CM_CACHE_STRING: - mf->AddCacheDefinition(name, value, doc, cmState::STRING); + mf->AddCacheDefinition(name, value, doc, cmStateEnums::STRING); break; case CM_CACHE_INTERNAL: - mf->AddCacheDefinition(name, value, doc, cmState::INTERNAL); + mf->AddCacheDefinition(name, value, doc, cmStateEnums::INTERNAL); break; case CM_CACHE_STATIC: - mf->AddCacheDefinition(name, value, doc, cmState::STATIC); + mf->AddCacheDefinition(name, value, doc, cmStateEnums::STATIC); break; } } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 7dc9e33..3a37eeb 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1969,7 +1969,7 @@ bool cmCTest::AddVariableDefinition(const std::string& arg) { std::string name; std::string value; - cmState::CacheEntryType type = cmState::UNINITIALIZED; + cmStateEnums::CacheEntryType type = cmStateEnums::UNINITIALIZED; if (cmake::ParseCacheEntry(arg, name, value, type)) { this->Definitions[name] = value; diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 4b03499..e84012c 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -94,13 +94,13 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal, // 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 != cmState::INTERNAL) || + if (internal || (e.Type != cmStateEnums::INTERNAL) || (includes.find(entryKey) != includes.end())) { // If we are loading the cache from another project, // make all loaded entries internal so that it is // not visible in the gui if (!internal) { - e.Type = cmState::INTERNAL; + e.Type = cmStateEnums::INTERNAL; helpString = "DO NOT EDIT, "; helpString += entryKey; helpString += " loaded from external file. " @@ -142,11 +142,11 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal, this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", "0", "Minor version of cmake used to create the " "current loaded cache", - cmState::INTERNAL); + cmStateEnums::INTERNAL); this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", "0", "Major version of cmake used to create the " "current loaded cache", - cmState::INTERNAL); + cmStateEnums::INTERNAL); } // check to make sure the cache directory has not // been moved @@ -178,7 +178,7 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey, CacheEntry& e) { // All property entries are internal. - if (e.Type != cmState::INTERNAL) { + if (e.Type != cmStateEnums::INTERNAL) { return false; } @@ -192,7 +192,7 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey, if (it.IsAtEnd()) { // Create an entry and store the property. CacheEntry& ne = this->Cache[key]; - ne.Type = cmState::UNINITIALIZED; + ne.Type = cmStateEnums::UNINITIALIZED; ne.SetProperty(*p, e.Value.c_str()); } else { // Store this property on its entry. @@ -244,17 +244,17 @@ bool cmCacheManager::SaveCache(const std::string& path) this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", temp, "Minor version of cmake used to create the " "current loaded cache", - cmState::INTERNAL); + cmStateEnums::INTERNAL); sprintf(temp, "%d", cmVersion::GetMajorVersion()); this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", temp, "Major version of cmake used to create the " "current loaded cache", - cmState::INTERNAL); + cmStateEnums::INTERNAL); sprintf(temp, "%d", cmVersion::GetPatchVersion()); this->AddCacheEntry("CMAKE_CACHE_PATCH_VERSION", temp, "Patch version of cmake used to create the " "current loaded cache", - cmState::INTERNAL); + cmStateEnums::INTERNAL); // Let us store the current working directory so that if somebody // Copies it, he will not be surprised @@ -268,7 +268,7 @@ bool cmCacheManager::SaveCache(const std::string& path) this->AddCacheEntry("CMAKE_CACHEFILE_DIR", currentcwd.c_str(), "This is the directory where this CMakeCache.txt" " was created", - cmState::INTERNAL); + cmStateEnums::INTERNAL); /* clang-format off */ fout << "# This is the CMakeCache file.\n" @@ -301,14 +301,14 @@ bool cmCacheManager::SaveCache(const std::string& path) this->Cache.begin(); i != this->Cache.end(); ++i) { const CacheEntry& ce = (*i).second; - cmState::CacheEntryType t = ce.Type; + cmStateEnums::CacheEntryType t = ce.Type; if (!ce.Initialized) { /* // This should be added in, but is not for now. cmSystemTools::Error("Cache entry \"", (*i).first.c_str(), "\" is uninitialized"); */ - } else if (t != cmState::INTERNAL) { + } else if (t != cmStateEnums::INTERNAL) { // Format is key:type=value if (const char* help = ce.GetProperty("HELPSTRING")) { cmCacheManager::OutputHelpString(fout, help); @@ -334,9 +334,9 @@ bool cmCacheManager::SaveCache(const std::string& path) continue; } - cmState::CacheEntryType t = i.GetType(); + cmStateEnums::CacheEntryType t = i.GetType(); this->WritePropertyEntries(fout, i); - if (t == cmState::INTERNAL) { + if (t == cmStateEnums::INTERNAL) { // Format is key:type=value if (const char* help = i.GetProperty("HELPSTRING")) { this->OutputHelpString(fout, help); @@ -465,7 +465,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 != cmState::INTERNAL) { + if ((*i).second.Type != cmStateEnums::INTERNAL) { out << (*i).first << " = " << (*i).second.Value << std::endl; } } @@ -477,7 +477,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const void cmCacheManager::AddCacheEntry(const std::string& key, const char* value, const char* helpString, - cmState::CacheEntryType type) + cmStateEnums::CacheEntryType type) { CacheEntry& e = this->Cache[key]; if (value) { @@ -488,7 +488,7 @@ void cmCacheManager::AddCacheEntry(const std::string& key, const char* value, } e.Type = type; // make sure we only use unix style paths - if (type == cmState::FILEPATH || type == cmState::PATH) { + if (type == cmStateEnums::FILEPATH || type == cmStateEnums::PATH) { if (e.Value.find(';') != e.Value.npos) { std::vector<std::string> paths; cmSystemTools::ExpandListArgument(e.Value, paths); diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 16a2e78..90731f5 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -34,7 +34,7 @@ private: struct CacheEntry { std::string Value; - cmState::CacheEntryType Type; + cmStateEnums::CacheEntryType Type; cmPropertyMap Properties; std::vector<std::string> GetPropertyList() const; const char* GetProperty(const std::string&) const; @@ -44,7 +44,7 @@ private: bool Initialized; CacheEntry() : Value("") - , Type(cmState::UNINITIALIZED) + , Type(cmStateEnums::UNINITIALIZED) , Initialized(false) { } @@ -70,8 +70,14 @@ public: const char* GetValue() const { return this->GetEntry().Value.c_str(); } bool GetValueAsBool() const; void SetValue(const char*); - cmState::CacheEntryType GetType() const { return this->GetEntry().Type; } - void SetType(cmState::CacheEntryType ty) { this->GetEntry().Type = ty; } + cmStateEnums::CacheEntryType GetType() const + { + return this->GetEntry().Type; + } + void SetType(cmStateEnums::CacheEntryType ty) + { + this->GetEntry().Type = ty; + } bool Initialized() { return this->GetEntry().Initialized; } cmCacheManager& Container; std::map<std::string, CacheEntry>::iterator Position; @@ -137,7 +143,7 @@ public: return this->GetCacheIterator(key.c_str()).GetProperty(propName); } - cmState::CacheEntryType GetCacheEntryType(std::string const& key) + cmStateEnums::CacheEntryType GetCacheEntryType(std::string const& key) { return this->GetCacheIterator(key.c_str()).GetType(); } @@ -200,7 +206,8 @@ public: protected: ///! Add an entry into the cache void AddCacheEntry(const std::string& key, const char* value, - const char* helpString, cmState::CacheEntryType type); + const char* helpString, + cmStateEnums::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 cafba86..e4a97a1 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -531,7 +531,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv, // set the result var to the return value to indicate success or failure this->Makefile->AddCacheDefinition(argv[0], (res == 0 ? "TRUE" : "FALSE"), "Result of TRY_COMPILE", - cmState::INTERNAL); + cmStateEnums::INTERNAL); if (!outputVariable.empty()) { this->Makefile->AddDefinition(outputVariable, output.c_str()); diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 7535e8c..b50db25 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -230,7 +230,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out, // in the cache valueToUse = envVarValue; mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(), - cacheEntryName.c_str(), cmState::STRING, true); + cacheEntryName.c_str(), cmStateEnums::STRING, true); mf->GetCMakeInstance()->SaveCache(lg->GetBinaryDirectory()); } else if (!envVarSet && cacheValue != CM_NULLPTR) { // It is already in the cache, but not in the env, so use it from the cache @@ -245,7 +245,8 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out, if (valueToUse.find(envVarValue) == std::string::npos) { valueToUse = envVarValue; mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(), - cacheEntryName.c_str(), cmState::STRING, true); + cacheEntryName.c_str(), cmStateEnums::STRING, + true); mf->GetCMakeInstance()->SaveCache(lg->GetBinaryDirectory()); } } diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index 982d740..b8b3463 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -308,7 +308,7 @@ bool cmFindBase::CheckForVariableInCache() // this. if (cached && state->GetCacheEntryType(this->VariableName) == - cmState::UNINITIALIZED) { + cmStateEnums::UNINITIALIZED) { this->AlreadyInCacheWithoutMetaInfo = true; } return true; diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 082350f..2909209 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -26,7 +26,7 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn, if (this->AlreadyInCacheWithoutMetaInfo) { this->Makefile->AddCacheDefinition(this->VariableName, "", this->VariableDocumentation.c_str(), - cmState::FILEPATH); + cmStateEnums::FILEPATH); } return true; } @@ -52,13 +52,13 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn, // Save the value in the cache this->Makefile->AddCacheDefinition(this->VariableName, library.c_str(), this->VariableDocumentation.c_str(), - cmState::FILEPATH); + cmStateEnums::FILEPATH); return true; } std::string notfound = this->VariableName + "-NOTFOUND"; this->Makefile->AddCacheDefinition(this->VariableName, notfound.c_str(), this->VariableDocumentation.c_str(), - cmState::FILEPATH); + cmStateEnums::FILEPATH); return true; } diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 554618e..5723999 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -890,7 +890,7 @@ bool cmFindPackageCommand::FindConfig() help += "."; // 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(), cmState::PATH, true); + help.c_str(), cmStateEnums::PATH, true); return found; } diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx index 35929fe..7d37185 100644 --- a/Source/cmFindPathCommand.cxx +++ b/Source/cmFindPathCommand.cxx @@ -26,7 +26,8 @@ bool cmFindPathCommand::InitialPass(std::vector<std::string> const& argsIn, if (this->AlreadyInCacheWithoutMetaInfo) { this->Makefile->AddCacheDefinition( this->VariableName, "", this->VariableDocumentation.c_str(), - (this->IncludeFileInPath ? cmState::FILEPATH : cmState::PATH)); + (this->IncludeFileInPath ? cmStateEnums::FILEPATH + : cmStateEnums::PATH)); } return true; } @@ -35,13 +36,13 @@ bool cmFindPathCommand::InitialPass(std::vector<std::string> const& argsIn, if (!result.empty()) { this->Makefile->AddCacheDefinition( this->VariableName, result.c_str(), this->VariableDocumentation.c_str(), - (this->IncludeFileInPath) ? cmState::FILEPATH : cmState::PATH); + (this->IncludeFileInPath) ? cmStateEnums::FILEPATH : cmStateEnums::PATH); return true; } this->Makefile->AddCacheDefinition( this->VariableName, (this->VariableName + "-NOTFOUND").c_str(), this->VariableDocumentation.c_str(), - (this->IncludeFileInPath) ? cmState::FILEPATH : cmState::PATH); + (this->IncludeFileInPath) ? cmStateEnums::FILEPATH : cmStateEnums::PATH); return true; } diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx index a6f2518..9886860 100644 --- a/Source/cmFindProgramCommand.cxx +++ b/Source/cmFindProgramCommand.cxx @@ -90,7 +90,7 @@ bool cmFindProgramCommand::InitialPass(std::vector<std::string> const& argsIn, if (this->AlreadyInCacheWithoutMetaInfo) { this->Makefile->AddCacheDefinition(this->VariableName, "", this->VariableDocumentation.c_str(), - cmState::FILEPATH); + cmStateEnums::FILEPATH); } return true; } @@ -100,13 +100,13 @@ bool cmFindProgramCommand::InitialPass(std::vector<std::string> const& argsIn, // Save the value in the cache this->Makefile->AddCacheDefinition(this->VariableName, result.c_str(), this->VariableDocumentation.c_str(), - cmState::FILEPATH); + cmStateEnums::FILEPATH); return true; } this->Makefile->AddCacheDefinition( this->VariableName, (this->VariableName + "-NOTFOUND").c_str(), - this->VariableDocumentation.c_str(), cmState::FILEPATH); + this->VariableDocumentation.c_str(), cmStateEnums::FILEPATH); return true; } diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx index 05dbfb4..c183947 100644 --- a/Source/cmGetFilenameComponentCommand.cxx +++ b/Source/cmGetFilenameComponentCommand.cxx @@ -88,13 +88,13 @@ bool cmGetFilenameComponentCommand::InitialPass( if (args.size() >= 4 && args[args.size() - 1] == "CACHE") { if (!programArgs.empty() && !storeArgs.empty()) { - this->Makefile->AddCacheDefinition(storeArgs, programArgs.c_str(), "", - args[2] == "PATH" ? cmState::FILEPATH - : cmState::STRING); + this->Makefile->AddCacheDefinition( + storeArgs, programArgs.c_str(), "", + args[2] == "PATH" ? cmStateEnums::FILEPATH : cmStateEnums::STRING); } - this->Makefile->AddCacheDefinition(args[0], result.c_str(), "", - args[2] == "PATH" ? cmState::FILEPATH - : cmState::STRING); + this->Makefile->AddCacheDefinition( + args[0], result.c_str(), "", + args[2] == "PATH" ? cmStateEnums::FILEPATH : cmStateEnums::STRING); } else { if (!programArgs.empty() && !storeArgs.empty()) { this->Makefile->AddDefinition(storeArgs, programArgs.c_str()); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 58c6a00..efa95a5 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -308,7 +308,7 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf) makeProgram += "/"; makeProgram += saveFile; mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", makeProgram.c_str(), - "make program", cmState::FILEPATH); + "make program", cmStateEnums::FILEPATH); } } @@ -1103,7 +1103,7 @@ void cmGlobalGenerator::Configure() sprintf(num, "%d", static_cast<int>(this->Makefiles.size())); this->GetCMakeInstance()->AddCacheEntry("CMAKE_NUMBER_OF_MAKEFILES", num, "number of local generators", - cmState::INTERNAL); + cmStateEnums::INTERNAL); // check for link libraries and include directories containing "NOTFOUND" // and for infinite loops @@ -1886,8 +1886,8 @@ void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator* gen, this->TryCompileOuterMakefile = mf; const char* make = gen->GetCMakeInstance()->GetCacheDefinition("CMAKE_MAKE_PROGRAM"); - this->GetCMakeInstance()->AddCacheEntry("CMAKE_MAKE_PROGRAM", make, - "make program", cmState::FILEPATH); + this->GetCMakeInstance()->AddCacheEntry( + "CMAKE_MAKE_PROGRAM", make, "make program", cmStateEnums::FILEPATH); // copy the enabled languages this->GetCMakeInstance()->GetState()->SetEnabledLanguages( gen->GetCMakeInstance()->GetState()->GetEnabledLanguages()); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 615670c..45f8151 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -93,7 +93,7 @@ std::string cmGlobalUnixMakefileGenerator3::GetEditCacheCommand() const if (!editCacheCommand.empty()) { cm->AddCacheEntry("CMAKE_EDIT_COMMAND", editCacheCommand.c_str(), "Path to cache edit program executable.", - cmState::INTERNAL); + cmStateEnums::INTERNAL); } } const char* edit_cmd = cm->GetCacheDefinition("CMAKE_EDIT_COMMAND"); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 1ffcf07..635d07e 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -101,7 +101,7 @@ void cmGlobalVisualStudio7Generator::EnableLanguage( "Semicolon separated list of supported configuration types, " "only supports Debug, Release, MinSizeRel, and RelWithDebInfo, " "anything else will be ignored.", - cmState::STRING); + cmStateEnums::STRING); } // Create list of configurations requested by user's cache, if any. @@ -118,7 +118,7 @@ void cmGlobalVisualStudio7Generator::EnableLanguage( if (cmSystemTools::GetEnv("CMAKE_MSVCIDE_RUN_PATH", extraPath)) { mf->AddCacheDefinition("CMAKE_MSVCIDE_RUN_PATH", extraPath.c_str(), "Saved environment variable CMAKE_MSVCIDE_RUN_PATH", - cmState::STATIC); + cmStateEnums::STATIC); } } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 34a01d6..6de4caa 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -257,7 +257,7 @@ void cmGlobalXCodeGenerator::EnableLanguage( "Semicolon separated list of supported configuration types, " "only supports Debug, Release, MinSizeRel, and RelWithDebInfo, " "anything else will be ignored.", - cmState::STRING); + cmStateEnums::STRING); } } mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); @@ -2432,8 +2432,9 @@ std::string cmGlobalXCodeGenerator::GetOrCreateId(const std::string& name, return storedGUID; } - this->CMakeInstance->AddCacheEntry( - guidStoreName, id.c_str(), "Stored Xcode object GUID", cmState::INTERNAL); + this->CMakeInstance->AddCacheEntry(guidStoreName, id.c_str(), + "Stored Xcode object GUID", + cmStateEnums::INTERNAL); return id; } diff --git a/Source/cmIncludeExternalMSProjectCommand.cxx b/Source/cmIncludeExternalMSProjectCommand.cxx index 57bf33e..d598722 100644 --- a/Source/cmIncludeExternalMSProjectCommand.cxx +++ b/Source/cmIncludeExternalMSProjectCommand.cxx @@ -66,7 +66,7 @@ bool cmIncludeExternalMSProjectCommand::InitialPass( std::string guidVariable = utility_name + "_GUID_CMAKE"; this->Makefile->GetCMakeInstance()->AddCacheEntry( guidVariable.c_str(), customGuid.c_str(), "Stored GUID", - cmState::INTERNAL); + cmStateEnums::INTERNAL); } // Create a target instance for this utility. diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx index 3428a6c..49db5b0 100644 --- a/Source/cmLoadCacheCommand.cxx +++ b/Source/cmLoadCacheCommand.cxx @@ -140,7 +140,7 @@ void cmLoadCacheCommand::CheckLine(const char* line) // Check one line of the cache file. std::string var; std::string value; - cmState::CacheEntryType type = cmState::UNINITIALIZED; + cmStateEnums::CacheEntryType type = cmStateEnums::UNINITIALIZED; if (cmake::ParseCacheEntry(line, var, value, type)) { // Found a real entry. See if this one was requested. if (this->VariablesToRead.find(var) != this->VariablesToRead.end()) { diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index 006cdf8..0516bdf 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -95,7 +95,7 @@ void cmLocalVisualStudio10Generator::ReadAndStoreExternalGUID( // save the GUID in the cache this->GlobalGenerator->GetCMakeInstance()->AddCacheEntry( guidStoreName.c_str(), parser.GUID.c_str(), "Stored GUID", - cmState::INTERNAL); + cmStateEnums::INTERNAL); } const char* cmLocalVisualStudio10Generator::ReportErrorLabel() const diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 1ea56b4..7c32e6c 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -2118,7 +2118,7 @@ void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID( // save the GUID in the cache this->GlobalGenerator->GetCMakeInstance()->AddCacheEntry( guidStoreName.c_str(), parser.GUID.c_str(), "Stored GUID", - cmState::INTERNAL); + cmStateEnums::INTERNAL); } std::string cmLocalVisualStudio7Generator::GetTargetDirectory( diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 65116d5..5036b0d 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1643,20 +1643,21 @@ void cmMakefile::AddDefinition(const std::string& name, const char* value) void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, const char* doc, - cmState::CacheEntryType type, bool force) + cmStateEnums::CacheEntryType type, + bool force) { const char* existingValue = this->GetState()->GetInitializedCacheValue(name); // must be outside the following if() to keep it alive long enough std::string nvalue; - if (existingValue && - (this->GetState()->GetCacheEntryType(name) == cmState::UNINITIALIZED)) { + if (existingValue && (this->GetState()->GetCacheEntryType(name) == + cmStateEnums::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 if (!force) { value = existingValue; } - if (type == cmState::PATH || type == cmState::FILEPATH) { + if (type == cmStateEnums::PATH || type == cmStateEnums::FILEPATH) { std::vector<std::string>::size_type cc; std::vector<std::string> files; nvalue = value ? value : ""; @@ -3177,7 +3178,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", - cmState::STRING); + cmStateEnums::STRING); } } // if cmake args were provided then pass them in @@ -3213,10 +3214,10 @@ int cmMakefile::TryCompile(const std::string& srcdir, gg->EnableLanguagesFromGenerator(this->GetGlobalGenerator(), this); if (this->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS")) { cm.AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "TRUE", "", - cmState::INTERNAL); + cmStateEnums::INTERNAL); } else { cm.AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "FALSE", "", - cmState::INTERNAL); + cmStateEnums::INTERNAL); } if (cm.Configure() != 0) { cmSystemTools::Error( diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 71078ab..e7e8a0b 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -224,7 +224,7 @@ public: void AddDefinition(const std::string& name, const char* value); ///! Add a definition to this makefile and the global cmake cache. void AddCacheDefinition(const std::string& name, const char* value, - const char* doc, cmState::CacheEntryType type, + const char* doc, cmStateEnums::CacheEntryType type, bool force = false); /** diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx index 5ec1620..8f9e288 100644 --- a/Source/cmMarkAsAdvancedCommand.cxx +++ b/Source/cmMarkAsAdvancedCommand.cxx @@ -26,7 +26,7 @@ bool cmMarkAsAdvancedCommand::InitialPass(std::vector<std::string> const& args, cmState* state = this->Makefile->GetState(); if (!state->GetCacheEntryValue(variable)) { this->Makefile->GetCMakeInstance()->AddCacheEntry( - variable, CM_NULLPTR, CM_NULLPTR, cmState::UNINITIALIZED); + variable, CM_NULLPTR, CM_NULLPTR, cmStateEnums::UNINITIALIZED); overwrite = true; } if (!state->GetCacheEntryValue(variable)) { diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index 946a543..0186ef2 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -32,7 +32,7 @@ bool cmOptionCommand::InitialPass(std::vector<std::string> const& args, cmState* state = this->Makefile->GetState(); const char* existingValue = state->GetCacheEntryValue(args[0]); if (existingValue) { - if (state->GetCacheEntryType(args[0]) != cmState::UNINITIALIZED) { + if (state->GetCacheEntryType(args[0]) != cmStateEnums::UNINITIALIZED) { state->SetCacheEntryProperty(args[0], "HELPSTRING", args[1]); return true; } @@ -43,6 +43,6 @@ bool cmOptionCommand::InitialPass(std::vector<std::string> const& args, } bool init = cmSystemTools::IsOn(initialValue.c_str()); this->Makefile->AddCacheDefinition(args[0], init ? "ON" : "OFF", - args[1].c_str(), cmState::BOOL); + args[1].c_str(), cmStateEnums::BOOL); return true; } diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 3402191..25acb52 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -233,7 +233,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, const char* version) "For backwards compatibility, what version of CMake " "commands and " "syntax should this version of CMake try to support.", - cmState::STRING); + cmStateEnums::STRING); } } } diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index c34a94b..c27da8e 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -19,10 +19,10 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args, this->Makefile->AddCacheDefinition( bindir, this->Makefile->GetCurrentBinaryDirectory(), - "Value Computed by CMake", cmState::STATIC); + "Value Computed by CMake", cmStateEnums::STATIC); this->Makefile->AddCacheDefinition( srcdir, this->Makefile->GetCurrentSourceDirectory(), - "Value Computed by CMake", cmState::STATIC); + "Value Computed by CMake", cmStateEnums::STATIC); bindir = "PROJECT_BINARY_DIR"; srcdir = "PROJECT_SOURCE_DIR"; @@ -45,7 +45,7 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args, this->Makefile->AddDefinition("CMAKE_PROJECT_NAME", args[0].c_str()); this->Makefile->AddCacheDefinition("CMAKE_PROJECT_NAME", args[0].c_str(), "Value Computed by CMake", - cmState::STATIC); + cmStateEnums::STATIC); } bool haveVersion = false; diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index 8ce0b18..65b0e9c 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -64,8 +64,9 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args, bool cache = false; // optional bool force = false; // optional bool parentScope = false; - cmState::CacheEntryType type = cmState::STRING; // required if cache - const char* docstring = CM_NULLPTR; // required if cache + cmStateEnums::CacheEntryType type = + cmStateEnums::STRING; // required if cache + const char* docstring = CM_NULLPTR; // required if cache unsigned int ignoreLastArgs = 0; // look for PARENT_SCOPE argument @@ -115,12 +116,12 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args, cmState* state = this->Makefile->GetState(); const char* existingValue = state->GetCacheEntryValue(variable); if (existingValue && - (state->GetCacheEntryType(variable) != cmState::UNINITIALIZED)) { + (state->GetCacheEntryType(variable) != cmStateEnums::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 != cmState::INTERNAL && !force) { + if (cache && type != cmStateEnums::INTERNAL && !force) { return true; } } diff --git a/Source/cmSiteNameCommand.cxx b/Source/cmSiteNameCommand.cxx index dbd3ed9..7664eca 100644 --- a/Source/cmSiteNameCommand.cxx +++ b/Source/cmSiteNameCommand.cxx @@ -68,7 +68,8 @@ bool cmSiteNameCommand::InitialPass(std::vector<std::string> const& args, #endif this->Makefile->AddCacheDefinition( args[0], siteName.c_str(), - "Name of the computer/site where compile is being run", cmState::STRING); + "Name of the computer/site where compile is being run", + cmStateEnums::STRING); return true; } diff --git a/Source/cmState.cxx b/Source/cmState.cxx index cdadbda..a52374f 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -147,7 +147,7 @@ const char* cmCacheEntryTypes[] = { "BOOL", "PATH", "FILEPATH", "STRING", "INTERNAL", "STATIC", "UNINITIALIZED", CM_NULLPTR }; -const char* cmState::CacheEntryTypeToString(cmState::CacheEntryType type) +const char* cmState::CacheEntryTypeToString(cmStateEnums::CacheEntryType type) { if (type > 6) { return cmCacheEntryTypes[6]; @@ -155,16 +155,16 @@ const char* cmState::CacheEntryTypeToString(cmState::CacheEntryType type) return cmCacheEntryTypes[type]; } -cmState::CacheEntryType cmState::StringToCacheEntryType(const char* s) +cmStateEnums::CacheEntryType cmState::StringToCacheEntryType(const char* s) { int i = 0; while (cmCacheEntryTypes[i]) { if (strcmp(s, cmCacheEntryTypes[i]) == 0) { - return static_cast<cmState::CacheEntryType>(i); + return static_cast<cmStateEnums::CacheEntryType>(i); } ++i; } - return STRING; + return cmStateEnums::STRING; } bool cmState::IsCacheEntryType(std::string const& key) @@ -219,7 +219,7 @@ const char* cmState::GetInitializedCacheValue(std::string const& key) const return this->CacheManager->GetInitializedCacheValue(key); } -cmState::CacheEntryType cmState::GetCacheEntryType( +cmStateEnums::CacheEntryType cmState::GetCacheEntryType( std::string const& key) const { cmCacheManager::CacheIterator it = @@ -279,7 +279,7 @@ bool cmState::GetCacheEntryPropertyAsBool(std::string const& key, void cmState::AddCacheEntry(const std::string& key, const char* value, const char* helpString, - cmState::CacheEntryType type) + cmStateEnums::CacheEntryType type) { this->CacheManager->AddCacheEntry(key, value, helpString, type); } @@ -1806,7 +1806,8 @@ static bool ParseEntryWithoutType(const std::string& entry, std::string& var, } bool cmState::ParseCacheEntry(const std::string& entry, std::string& var, - std::string& value, CacheEntryType& type) + std::string& value, + cmStateEnums::CacheEntryType& type) { // input line is: key:type=value static cmsys::RegularExpression reg( diff --git a/Source/cmState.h b/Source/cmState.h index 521870d..fdbbc98 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -56,6 +56,16 @@ enum TargetType INTERFACE_LIBRARY, UNKNOWN_LIBRARY }; +enum CacheEntryType +{ + BOOL = 0, + PATH, + FILEPATH, + STRING, + INTERNAL, + STATIC, + UNINITIALIZED +}; } class cmState @@ -214,18 +224,8 @@ public: Snapshot CreatePolicyScopeSnapshot(Snapshot originSnapshot); Snapshot Pop(Snapshot originSnapshot); - enum CacheEntryType - { - BOOL = 0, - PATH, - FILEPATH, - STRING, - INTERNAL, - STATIC, - UNINITIALIZED - }; - static CacheEntryType StringToCacheEntryType(const char*); - static const char* CacheEntryTypeToString(CacheEntryType); + static cmStateEnums::CacheEntryType StringToCacheEntryType(const char*); + static const char* CacheEntryTypeToString(cmStateEnums::CacheEntryType); static bool IsCacheEntryType(std::string const& key); bool LoadCache(const std::string& path, bool internal, @@ -239,7 +239,7 @@ public: std::vector<std::string> GetCacheEntryKeys() const; const char* GetCacheEntryValue(std::string const& key) const; const char* GetInitializedCacheValue(std::string const& key) const; - CacheEntryType GetCacheEntryType(std::string const& key) const; + cmStateEnums::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); @@ -264,7 +264,8 @@ public: ///! Break up a line like VAR:type="value" into var, type and value static bool ParseCacheEntry(const std::string& entry, std::string& var, - std::string& value, CacheEntryType& type); + std::string& value, + cmStateEnums::CacheEntryType& type); Snapshot Reset(); // Define a property @@ -328,7 +329,8 @@ public: private: friend class cmake; void AddCacheEntry(const std::string& key, const char* value, - const char* helpString, CacheEntryType type); + const char* helpString, + cmStateEnums::CacheEntryType type); std::map<cmProperty::ScopeType, cmPropertyDefinitionMap> PropertyDefinitions; std::vector<std::string> EnabledLanguages; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 5753dd8..2527366 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -635,7 +635,7 @@ void cmTarget::ClearDependencyInformation(cmMakefile& mf, depname += "_LIB_DEPENDS"; if (this->RecordDependencies) { mf.AddCacheDefinition(depname, "", "Dependencies for target", - cmState::STATIC); + cmStateEnums::STATIC); } else { if (mf.GetDefinition(depname)) { std::string message = "Target "; @@ -773,7 +773,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, const std::string& lib, dependencies += lib; dependencies += ";"; mf.AddCacheDefinition(targetEntry, dependencies.c_str(), - "Dependencies for the target", cmState::STATIC); + "Dependencies for the target", cmStateEnums::STATIC); } } diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index 5c9e41a..b248489 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -189,7 +189,8 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs, strcpy(retChar, "FAILED_TO_RUN"); } this->Makefile->AddCacheDefinition(this->RunResultVariable, retChar, - "Result of TRY_RUN", cmState::INTERNAL); + "Result of TRY_RUN", + cmStateEnums::INTERNAL); } /* This is only used when cross compiling. Instead of running the @@ -231,7 +232,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, comment += detailsString; this->Makefile->AddCacheDefinition(this->RunResultVariable, "PLEASE_FILL_OUT-FAILED_TO_RUN", - comment.c_str(), cmState::STRING); + comment.c_str(), cmStateEnums::STRING); cmState* state = this->Makefile->GetState(); const char* existingValue = @@ -254,9 +255,9 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, "would have printed on stdout and stderr on its target platform.\n"; comment += detailsString; - this->Makefile->AddCacheDefinition(internalRunOutputName, - "PLEASE_FILL_OUT-NOTFOUND", - comment.c_str(), cmState::STRING); + this->Makefile->AddCacheDefinition( + internalRunOutputName, "PLEASE_FILL_OUT-NOTFOUND", comment.c_str(), + cmStateEnums::STRING); cmState* state = this->Makefile->GetState(); const char* existing = state->GetCacheEntryValue(internalRunOutputName); if (existing) { diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx index 08ea21e..8f25cbb 100644 --- a/Source/cmUtilitySourceCommand.cxx +++ b/Source/cmUtilitySourceCommand.cxx @@ -98,13 +98,13 @@ bool cmUtilitySourceCommand::InitialPass(std::vector<std::string> const& args, // Enter the value into the cache. this->Makefile->AddCacheDefinition(cacheEntry, utilityExecutable.c_str(), "Path to an internal program.", - cmState::FILEPATH); + cmStateEnums::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.", - cmState::INTERNAL); + cmStateEnums::INTERNAL); return true; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 5936d77..b50c8bd 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -315,7 +315,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) } } std::string var, value; - cmState::CacheEntryType type = cmState::UNINITIALIZED; + cmStateEnums::CacheEntryType type = cmStateEnums::UNINITIALIZED; if (cmState::ParseCacheEntry(entry, var, value, type)) { // The value is transformed if it is a filepath for example, so // we can't compare whether the value is already in the cache until @@ -410,8 +410,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) std::vector<std::string> cacheKeys = this->State->GetCacheEntryKeys(); for (std::vector<std::string>::const_iterator it = cacheKeys.begin(); it != cacheKeys.end(); ++it) { - cmState::CacheEntryType t = this->State->GetCacheEntryType(*it); - if (t != cmState::STATIC) { + cmStateEnums::CacheEntryType t = this->State->GetCacheEntryType(*it); + if (t != cmStateEnums::STATIC) { if (regex.find(it->c_str())) { entriesToDelete.push_back(*it); } @@ -859,14 +859,14 @@ int cmake::AddCMakePaths() // Save the value in the cache this->AddCacheEntry("CMAKE_COMMAND", cmSystemTools::GetCMakeCommand().c_str(), - "Path to CMake executable.", cmState::INTERNAL); + "Path to CMake executable.", cmStateEnums::INTERNAL); #ifdef CMAKE_BUILD_WITH_CMAKE - this->AddCacheEntry("CMAKE_CTEST_COMMAND", - cmSystemTools::GetCTestCommand().c_str(), - "Path to ctest program executable.", cmState::INTERNAL); - this->AddCacheEntry("CMAKE_CPACK_COMMAND", - cmSystemTools::GetCPackCommand().c_str(), - "Path to cpack program executable.", cmState::INTERNAL); + this->AddCacheEntry( + "CMAKE_CTEST_COMMAND", cmSystemTools::GetCTestCommand().c_str(), + "Path to ctest program executable.", cmStateEnums::INTERNAL); + this->AddCacheEntry( + "CMAKE_CPACK_COMMAND", cmSystemTools::GetCPackCommand().c_str(), + "Path to cpack program executable.", cmStateEnums::INTERNAL); #endif if (!cmSystemTools::FileExists( (cmSystemTools::GetCMakeRoot() + "/Modules/CMake.cmake").c_str())) { @@ -879,7 +879,7 @@ int cmake::AddCMakePaths() return 0; } this->AddCacheEntry("CMAKE_ROOT", cmSystemTools::GetCMakeRoot().c_str(), - "Path to CMake installation.", cmState::INTERNAL); + "Path to CMake installation.", cmStateEnums::INTERNAL); return 1; } @@ -1147,7 +1147,7 @@ struct SaveCacheEntry std::string key; std::string value; std::string help; - cmState::CacheEntryType type; + cmStateEnums::CacheEntryType type; }; int cmake::HandleDeleteCacheVariables(const std::string& var) @@ -1291,7 +1291,7 @@ int cmake::ActualConfigure() "CMAKE_HOME_DIRECTORY", this->GetHomeDirectory(), "Source directory with the top level CMakeLists.txt file for this " "project", - cmState::INTERNAL); + cmStateEnums::INTERNAL); } // no generator specified on the command line @@ -1338,11 +1338,11 @@ int cmake::ActualConfigure() if (!this->State->GetInitializedCacheValue("CMAKE_GENERATOR")) { this->AddCacheEntry("CMAKE_GENERATOR", this->GlobalGenerator->GetName().c_str(), - "Name of generator.", cmState::INTERNAL); + "Name of generator.", cmStateEnums::INTERNAL); this->AddCacheEntry("CMAKE_EXTRA_GENERATOR", this->GlobalGenerator->GetExtraGeneratorName().c_str(), "Name of external makefile project generator.", - cmState::INTERNAL); + cmStateEnums::INTERNAL); } if (const char* platformName = @@ -1362,7 +1362,7 @@ int cmake::ActualConfigure() } else { this->AddCacheEntry("CMAKE_GENERATOR_PLATFORM", this->GeneratorPlatform.c_str(), - "Name of generator platform.", cmState::INTERNAL); + "Name of generator platform.", cmStateEnums::INTERNAL); } if (const char* tsName = @@ -1382,7 +1382,7 @@ int cmake::ActualConfigure() } else { this->AddCacheEntry("CMAKE_GENERATOR_TOOLSET", this->GeneratorToolset.c_str(), - "Name of generator toolset.", cmState::INTERNAL); + "Name of generator toolset.", cmStateEnums::INTERNAL); } // reset any system configuration information, except for when we are @@ -1411,13 +1411,14 @@ int cmake::ActualConfigure() if (!this->State->GetInitializedCacheValue("LIBRARY_OUTPUT_PATH")) { this->AddCacheEntry( "LIBRARY_OUTPUT_PATH", "", - "Single output directory for building all libraries.", cmState::PATH); + "Single output directory for building all libraries.", + cmStateEnums::PATH); } if (!this->State->GetInitializedCacheValue("EXECUTABLE_OUTPUT_PATH")) { this->AddCacheEntry( "EXECUTABLE_OUTPUT_PATH", "", "Single output directory for building all executables.", - cmState::PATH); + cmStateEnums::PATH); } } @@ -1640,7 +1641,7 @@ void cmake::AddCacheEntry(const std::string& key, const char* value, const char* helpString, int type) { this->State->AddCacheEntry(key, value, helpString, - cmState::CacheEntryType(type)); + cmStateEnums::CacheEntryType(type)); this->UnwatchUnusedCli(key); } @@ -1694,7 +1695,8 @@ void cmake::AddDefaultGenerators() } bool cmake::ParseCacheEntry(const std::string& entry, std::string& var, - std::string& value, cmState::CacheEntryType& type) + std::string& value, + cmStateEnums::CacheEntryType& type) { return cmState::ParseCacheEntry(entry, var, value, type); } @@ -2464,7 +2466,7 @@ void cmake::SetSuppressDevWarnings(bool b) this->AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", value.c_str(), "Suppress Warnings that are meant for" " the author of the CMakeLists.txt files.", - cmState::INTERNAL); + cmStateEnums::INTERNAL); } bool cmake::GetSuppressDeprecatedWarnings() const @@ -2488,7 +2490,7 @@ void cmake::SetSuppressDeprecatedWarnings(bool b) this->AddCacheEntry("CMAKE_WARN_DEPRECATED", value.c_str(), "Whether to issue warnings for deprecated " "functionality.", - cmState::INTERNAL); + cmStateEnums::INTERNAL); } bool cmake::GetDevWarningsAsErrors() const @@ -2512,7 +2514,7 @@ void cmake::SetDevWarningsAsErrors(bool b) this->AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_ERRORS", value.c_str(), "Suppress errors that are meant for" " the author of the CMakeLists.txt files.", - cmState::INTERNAL); + cmStateEnums::INTERNAL); } bool cmake::GetDeprecatedWarningsAsErrors() const @@ -2536,5 +2538,5 @@ void cmake::SetDeprecatedWarningsAsErrors(bool b) this->AddCacheEntry("CMAKE_ERROR_DEPRECATED", value.c_str(), "Whether to issue deprecation errors for macros" " and functions.", - cmState::INTERNAL); + cmStateEnums::INTERNAL); } diff --git a/Source/cmake.h b/Source/cmake.h index 865748b..cff753f 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -161,7 +161,7 @@ public: ///! Break up a line like VAR:type="value" into var, type and value static bool ParseCacheEntry(const std::string& entry, std::string& var, std::string& value, - cmState::CacheEntryType& type); + cmStateEnums::CacheEntryType& type); int LoadCache(); bool LoadCache(const std::string& path); diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 0d1f1ce..d1159c3 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -292,9 +292,9 @@ int do_cmake(int ac, char const* const* av) std::vector<std::string> keys = cm.GetState()->GetCacheEntryKeys(); for (std::vector<std::string>::const_iterator it = keys.begin(); it != keys.end(); ++it) { - cmState::CacheEntryType t = cm.GetState()->GetCacheEntryType(*it); - if (t != cmState::INTERNAL && t != cmState::STATIC && - t != cmState::UNINITIALIZED) { + cmStateEnums::CacheEntryType t = cm.GetState()->GetCacheEntryType(*it); + if (t != cmStateEnums::INTERNAL && t != cmStateEnums::STATIC && + t != cmStateEnums::UNINITIALIZED) { const char* advancedProp = cm.GetState()->GetCacheEntryProperty(*it, "ADVANCED"); if (list_all_cached || !advancedProp) { |