summaryrefslogtreecommitdiffstats
path: root/Source/cmakewizard.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2002-09-11 18:05:45 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2002-09-11 18:05:45 (GMT)
commitbef93dc5c1cd7985013c9df096efbaa9b79dd7ac (patch)
tree4c028cecff3e8b237edf794b93852e42fefa2e1b /Source/cmakewizard.cxx
parentbfdf8f7dcdbefe408adecd903fd669f62ad4815b (diff)
downloadCMake-bef93dc5c1cd7985013c9df096efbaa9b79dd7ac.zip
CMake-bef93dc5c1cd7985013c9df096efbaa9b79dd7ac.tar.gz
CMake-bef93dc5c1cd7985013c9df096efbaa9b79dd7ac.tar.bz2
Couple of changes: cache variables now have a map of properties. ADVANCED and HELPSTRING are now properties of cache variable, IsAdvanced is gone, so is GetCacheEntry, since cache entries are now all private. To access them, you use the iterator. -ADVANCED cache entries are gone and are replaced by the property of cache variables. The cache file still looks the same, but the -ADVANCED cache entries are created when writing file. MarkAsAdvanced and VariableRequires are fixed. So are curses gui and wizard
Diffstat (limited to 'Source/cmakewizard.cxx')
-rw-r--r--Source/cmakewizard.cxx58
1 files changed, 27 insertions, 31 deletions
diff --git a/Source/cmakewizard.cxx b/Source/cmakewizard.cxx
index 4669206..2144a41 100644
--- a/Source/cmakewizard.cxx
+++ b/Source/cmakewizard.cxx
@@ -24,39 +24,33 @@ cmakewizard::cmakewizard()
}
-void cmakewizard::AskUser(const char* key, cmCacheManager::CacheEntry & entry,
+void cmakewizard::AskUser(const char* key, cmCacheManager::CacheIterator& iter,
cmCacheManager *cacheManager)
{
std::cout << "Variable Name: " << key << "\n";
- std::cout << "Description: " << entry.m_HelpString << "\n";
- std::cout << "Current Value: " << entry.m_Value.c_str() << "\n";
+ const char* helpstring = iter.GetProperty("HELPSTRING");
+ std::cout << "Description: " << (helpstring?helpstring:"(none)") << "\n";
+ std::cout << "Current Value: " << iter.GetValue() << "\n";
std::cout << "New Value (Enter to keep current value): ";
char buffer[4096];
buffer[0] = 0;
std::cin.getline(buffer, sizeof(buffer));
if(buffer[0])
{
- cmCacheManager::CacheEntry *entry = cacheManager->GetCacheEntry(key);
- if(entry)
+ std::string value = buffer;
+ if(iter.GetType() == cmCacheManager::PATH ||
+ iter.GetType() == cmCacheManager::FILEPATH)
{
- entry->m_Value = buffer;
- if(entry->m_Type == cmCacheManager::PATH ||
- entry->m_Type == cmCacheManager::FILEPATH)
- {
- cmSystemTools::ConvertToUnixSlashes(entry->m_Value);
- }
- if(entry->m_Type == cmCacheManager::BOOL)
- {
- if(!cmSystemTools::IsOn(buffer))
- {
- entry->m_Value = "OFF";
- }
- }
+ cmSystemTools::ConvertToUnixSlashes(value);
}
- else
+ if(iter.GetType() == cmCacheManager::BOOL)
{
- std::cerr << "strange error, should be in cache but is not... " << key << "\n";
+ if(!cmSystemTools::IsOn(value.c_str()))
+ {
+ value = "OFF";
+ }
}
+ iter.SetValue(value.c_str());
}
std::cout << "\n";
}
@@ -90,7 +84,8 @@ void cmakewizard::RunWizard(std::vector<std::string> const& args)
m_ShowAdvanced = this->AskAdvanced();
cmSystemTools::DisableRunCommandOutput();
cmake make;
- cmCacheManager::CacheEntryMap askedCache;
+ make.SetArgs(args);
+ std::map<std::string,std::string> askedCache;
bool asked = false;
// continue asking questions until no new questions are asked
do
@@ -98,6 +93,7 @@ void cmakewizard::RunWizard(std::vector<std::string> const& args)
asked = false;
// run cmake
this->ShowMessage("Please wait while cmake processes CMakeLists.txt files....\n");
+
make.Configure(args[0].c_str(),&args);
this->ShowMessage("\n");
// load the cache from disk
@@ -109,33 +105,33 @@ void cmakewizard::RunWizard(std::vector<std::string> const& args)
for(;!i.IsAtEnd(); i.Next())
{
std::string key = i.GetName();
- cmCacheManager::CacheEntry ce = i.GetEntry();
- if(ce.m_Type == cmCacheManager::INTERNAL
- || ce.m_Type == cmCacheManager::STATIC)
+ if( i.GetType() == cmCacheManager::INTERNAL ||
+ i.GetType() == cmCacheManager::STATIC ||
+ i.GetType() == cmCacheManager::UNINITIALIZED )
{
continue;
}
if(askedCache.count(key))
{
- cmCacheManager::CacheEntry& e = askedCache.find(key)->second;
- if(e.m_Value != ce.m_Value)
+ std::string& e = askedCache.find(key)->second;
+ if(e != i.GetValue())
{
- if(m_ShowAdvanced || !cachem->IsAdvanced(key.c_str()))
+ if(m_ShowAdvanced || !i.GetPropertyAsBool("ADVANCED"))
{
- this->AskUser(key.c_str(), ce, cachem);
+ this->AskUser(key.c_str(), i, cachem);
asked = true;
}
}
}
else
{
- if(m_ShowAdvanced || !cachem->IsAdvanced(key.c_str()))
+ if(m_ShowAdvanced || !i.GetPropertyAsBool("ADVANCED"))
{
- this->AskUser(key.c_str(), ce, cachem);
+ this->AskUser(key.c_str(), i, cachem);
asked = true;
}
}
- askedCache[key] = i.GetEntry();
+ askedCache[key] = i.GetValue();
}
cachem->SaveCache(cmSystemTools::GetCurrentWorkingDirectory().c_str());
}