diff options
author | Berk Geveci <berk.geveci@kitware.com> | 2001-08-15 17:40:56 (GMT) |
---|---|---|
committer | Berk Geveci <berk.geveci@kitware.com> | 2001-08-15 17:40:56 (GMT) |
commit | 06a0f67f93435e49d14c45c234a0bf2246b28b83 (patch) | |
tree | df5985b53ece52d974e93a6227c8ac2517de1f64 /Source/cmCacheManager.cxx | |
parent | 1cf9a35680d64fa30221e35397d9ee5263c3c169 (diff) | |
download | CMake-06a0f67f93435e49d14c45c234a0bf2246b28b83.zip CMake-06a0f67f93435e49d14c45c234a0bf2246b28b83.tar.gz CMake-06a0f67f93435e49d14c45c234a0bf2246b28b83.tar.bz2 |
1. Added EXCLUDE option to LOAD_CACHE.
2. Entries brought in from another cache are now marked as internal.
Diffstat (limited to 'Source/cmCacheManager.cxx')
-rw-r--r-- | Source/cmCacheManager.cxx | 50 |
1 files changed, 42 insertions, 8 deletions
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 3715f09..7c01fe2 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -106,9 +106,18 @@ bool cmCacheManager::LoadCache(const char* path) { return this->LoadCache(path,true); } + bool cmCacheManager::LoadCache(const char* path, bool internal) { + std::set<std::string> emptySet; + return this->LoadCache(path, internal, emptySet); +} + +bool cmCacheManager::LoadCache(const char* path, + bool internal, + std::set<std::string>& excludes) +{ std::string cacheFile = path; cacheFile += "/CMakeCache.txt"; // clear the old cache, if we are reading in internal values @@ -127,6 +136,9 @@ bool cmCacheManager::LoadCache(const char* path, cmRegularExpression reg("^([^:]*):([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$"); // input line is: "key":type=value cmRegularExpression regQuoted("^\"([^\"]*)\":([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$"); + + std::set<std::string>::const_iterator iter; + std::string entryKey; while(fin) { // Format is key:type=value @@ -148,22 +160,44 @@ bool cmCacheManager::LoadCache(const char* path, } if(regQuoted.find(buffer)) { - e.m_Type = cmCacheManager::StringToType(regQuoted.match(2).c_str()); - // only load internal values if internal is set - if (internal || e.m_Type != INTERNAL) + entryKey = regQuoted.match(1); + if ( excludes.find(entryKey) == excludes.end() ) { + e.m_Type = cmCacheManager::StringToType(regQuoted.match(2).c_str()); + // only load internal values if internal is set + if (internal || e.m_Type != INTERNAL) + { + // 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.m_Type = INTERNAL; + } e.m_Value = regQuoted.match(3); - m_Cache[regQuoted.match(1)] = e; + m_Cache[entryKey] = e; + } } } else if (reg.find(buffer)) { - e.m_Type = cmCacheManager::StringToType(reg.match(2).c_str()); - // only load internal values if internal is set - if (internal || e.m_Type != INTERNAL) + entryKey = reg.match(1); + if ( excludes.find(entryKey) == excludes.end() ) { + e.m_Type = cmCacheManager::StringToType(reg.match(2).c_str()); + // only load internal values if internal is set + if (internal || e.m_Type != INTERNAL) + { + // 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.m_Type = INTERNAL; + } e.m_Value = reg.match(3); - m_Cache[reg.match(1)] = e; + m_Cache[entryKey] = e; + } } } else |