summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2002-09-17 15:48:52 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2002-09-17 15:48:52 (GMT)
commit577cf9194542b874676a08291f3a27a65784d017 (patch)
treebd6840be8cae58d1f0800df1e8397ced84a33608
parente5e0132203ab8b8c2391ad7847cf2204d1e44639 (diff)
downloadCMake-577cf9194542b874676a08291f3a27a65784d017.zip
CMake-577cf9194542b874676a08291f3a27a65784d017.tar.gz
CMake-577cf9194542b874676a08291f3a27a65784d017.tar.bz2
Fix problems with advanced not being marked.
-rw-r--r--Source/cmCacheManager.cxx22
-rw-r--r--Source/cmCacheManager.h1
-rw-r--r--Source/cmMarkAsAdvancedCommand.cxx2
3 files changed, 22 insertions, 3 deletions
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index f77c231..5549af2 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -372,7 +372,7 @@ bool cmCacheManager::SaveCache(const char* path)
!i.IsAtEnd(); i.Next())
{
CacheEntryType t = i.GetType();
- bool advanced = i.GetPropertyAsBool("ADVANCED");
+ bool advanced = i.PropertyExists("ADVANCED");
if ( advanced )
{
// Format is key:type=value
@@ -397,7 +397,8 @@ bool cmCacheManager::SaveCache(const char* path)
{
key = rkey;
}
- fout << key.c_str() << ":INTERNAL=1\n";
+ fout << key.c_str() << ":INTERNAL="
+ << (i.GetPropertyAsBool("ADVANCED") ? "1" : "0") << "\n";
}
if(t == cmCacheManager::INTERNAL)
{
@@ -676,3 +677,20 @@ void cmCacheManager::CacheIterator::SetProperty(const char* p, bool v)
ent->m_Properties[p] = v ? "ON" : "OFF";
}
+bool cmCacheManager::CacheIterator::PropertyExists(const char* property) const
+{
+ if ( !strcmp(property, "TYPE") || !strcmp(property, "VALUE") )
+ {
+ cmSystemTools::Error("Property \"", property,
+ "\" cannot be accessed through the PropertyExists()");
+ return false;
+ }
+ const CacheEntry* ent = &this->GetEntry();
+ std::map<cmStdString,cmStdString>::const_iterator it =
+ ent->m_Properties.find(property);
+ if ( it == ent->m_Properties.end() )
+ {
+ return false;
+ }
+ return true;
+}
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index 648f735..84d5a2c 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -53,6 +53,7 @@ public:
return m_Position->first.c_str(); }
const char* GetProperty(const char*) const ;
bool GetPropertyAsBool(const char*) const ;
+ bool PropertyExists(const char*) const;
void SetProperty(const char* property, const char* value);
void SetProperty(const char* property, bool value);
const char* GetValue() const { return this->GetEntry().m_Value.c_str(); }
diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx
index 1e71b2d..72768c7 100644
--- a/Source/cmMarkAsAdvancedCommand.cxx
+++ b/Source/cmMarkAsAdvancedCommand.cxx
@@ -56,7 +56,7 @@ bool cmMarkAsAdvancedCommand::InitialPass(std::vector<std::string> const& argsIn
cmSystemTools::Error("This should never happen...");
return false;
}
- if ( overwrite )
+ if ( !it.PropertyExists("ADVANCED") || overwrite )
{
it.SetProperty("ADVANCED", value);
}