diff options
author | Clinton Stimpson <clinton@elemtech.com> | 2007-11-13 04:54:49 (GMT) |
---|---|---|
committer | Clinton Stimpson <clinton@elemtech.com> | 2007-11-13 04:54:49 (GMT) |
commit | a81896eaedc17f11e3fb412a296309abd9e34b63 (patch) | |
tree | 8e1204cfa77852920fa730dec0e97a3b09926818 /Source/QtDialog/QCMake.cxx | |
parent | 45a8e26fe159e6c0847addb3dbc126a852779f5a (diff) | |
download | CMake-a81896eaedc17f11e3fb412a296309abd9e34b63.zip CMake-a81896eaedc17f11e3fb412a296309abd9e34b63.tar.gz CMake-a81896eaedc17f11e3fb412a296309abd9e34b63.tar.bz2 |
ENH: Add ability to add cache entries (even before first configure).
Diffstat (limited to 'Source/QtDialog/QCMake.cxx')
-rw-r--r-- | Source/QtDialog/QCMake.cxx | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 48a9c57..92fca88 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -148,9 +148,13 @@ void QCMake::generate() emit this->generateDone(err); } -void QCMake::setProperties(const QCMakeCachePropertyList& props) +void QCMake::setProperties(const QCMakeCachePropertyList& newProps) { + QCMakeCachePropertyList props = newProps; + QStringList toremove; + + // set the value of properties cmCacheManager *cachem = this->CMakeInstance->GetCacheManager(); for(cmCacheManager::CacheIterator i = cachem->NewIterator(); !i.IsAtEnd(); i.Next()) @@ -180,15 +184,50 @@ void QCMake::setProperties(const QCMakeCachePropertyList& props) { i.SetValue(prop.Value.toString().toAscii().data()); } + props.removeAt(idx); } } + // remove some properites foreach(QString s, toremove) { cachem->RemoveCacheEntry(s.toAscii().data()); } + // add some new properites + foreach(QCMakeCacheProperty s, props) + { + if(s.Type == QCMakeCacheProperty::BOOL) + { + this->CMakeInstance->AddCacheEntry(s.Key.toAscii().data(), + s.Value.toBool() ? "ON" : "OFF", + s.Help.toAscii().data(), + cmCacheManager::BOOL); + } + else if(s.Type == QCMakeCacheProperty::STRING) + { + this->CMakeInstance->AddCacheEntry(s.Key.toAscii().data(), + s.Value.toString().toAscii().data(), + s.Help.toAscii().data(), + cmCacheManager::STRING); + } + else if(s.Type == QCMakeCacheProperty::PATH) + { + this->CMakeInstance->AddCacheEntry(s.Key.toAscii().data(), + s.Value.toString().toAscii().data(), + s.Help.toAscii().data(), + cmCacheManager::PATH); + } + else if(s.Type == QCMakeCacheProperty::FILEPATH) + { + this->CMakeInstance->AddCacheEntry(s.Key.toAscii().data(), + s.Value.toString().toAscii().data(), + s.Help.toAscii().data(), + cmCacheManager::FILEPATH); + } + } + cachem->SaveCache(this->BinaryDirectory.toAscii().data()); } |