BUG: Fix cache properties for CMAKE_STRICT build

All cmPropertyMap instances must have CMakeInstance set.  This teaches
cmCacheManager to set it on cache entries.
This commit is contained in:
Brad King 2009-03-13 10:53:47 -04:00
parent c6d0043e2a
commit 5e49dc4346
3 changed files with 9 additions and 3 deletions

View File

@ -42,10 +42,11 @@ const char* cmCacheManagerTypes[] =
0 0
}; };
cmCacheManager::cmCacheManager() cmCacheManager::cmCacheManager(cmake* cm)
{ {
this->CacheMajorVersion = 0; this->CacheMajorVersion = 0;
this->CacheMinorVersion = 0; this->CacheMinorVersion = 0;
this->CMakeInstance = cm;
} }
const char* cmCacheManager::TypeToString(cmCacheManager::CacheEntryType type) const char* cmCacheManager::TypeToString(cmCacheManager::CacheEntryType type)
@ -226,6 +227,7 @@ bool cmCacheManager::LoadCache(const char* path,
// Format is key:type=value // Format is key:type=value
std::string helpString; std::string helpString;
CacheEntry e; CacheEntry e;
e.Properties.SetCMakeInstance(this->CMakeInstance);
cmSystemTools::GetLineFromStream(fin, buffer); cmSystemTools::GetLineFromStream(fin, buffer);
realbuffer = buffer.c_str(); realbuffer = buffer.c_str();
while(*realbuffer != '0' && while(*realbuffer != '0' &&
@ -384,6 +386,7 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey,
{ {
// Create an entry and store the property. // Create an entry and store the property.
CacheEntry& ne = this->Cache[key]; CacheEntry& ne = this->Cache[key];
ne.Properties.SetCMakeInstance(this->CMakeInstance);
ne.Type = cmCacheManager::UNINITIALIZED; ne.Type = cmCacheManager::UNINITIALIZED;
ne.SetProperty(*p, e.Value.c_str()); ne.SetProperty(*p, e.Value.c_str());
} }
@ -724,6 +727,7 @@ void cmCacheManager::AddCacheEntry(const char* key,
CacheEntryType type) CacheEntryType type)
{ {
CacheEntry& e = this->Cache[key]; CacheEntry& e = this->Cache[key];
e.Properties.SetCMakeInstance(this->CMakeInstance);
if ( value ) if ( value )
{ {
e.Value = value; e.Value = value;

View File

@ -21,6 +21,7 @@
#include "cmPropertyMap.h" #include "cmPropertyMap.h"
class cmMakefile; class cmMakefile;
class cmMarkAsAdvancedCommand; class cmMarkAsAdvancedCommand;
class cmake;
/** \class cmCacheManager /** \class cmCacheManager
* \brief Control class for cmake's cache * \brief Control class for cmake's cache
@ -31,7 +32,7 @@ class cmMarkAsAdvancedCommand;
class cmCacheManager class cmCacheManager
{ {
public: public:
cmCacheManager(); cmCacheManager(cmake* cm);
class CacheIterator; class CacheIterator;
friend class cmCacheManager::CacheIterator; friend class cmCacheManager::CacheIterator;
enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC, enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC,
@ -175,6 +176,7 @@ protected:
unsigned int CacheMajorVersion; unsigned int CacheMajorVersion;
unsigned int CacheMinorVersion; unsigned int CacheMinorVersion;
private: private:
cmake* CMakeInstance;
typedef std::map<cmStdString, CacheEntry> CacheEntryMap; typedef std::map<cmStdString, CacheEntry> CacheEntryMap;
static void OutputHelpString(std::ostream& fout, static void OutputHelpString(std::ostream& fout,
const std::string& helpString); const std::string& helpString);

View File

@ -176,7 +176,7 @@ cmake::cmake()
this->Verbose = false; this->Verbose = false;
this->InTryCompile = false; this->InTryCompile = false;
this->CacheManager = new cmCacheManager; this->CacheManager = new cmCacheManager(this);
this->GlobalGenerator = 0; this->GlobalGenerator = 0;
this->ProgressCallback = 0; this->ProgressCallback = 0;
this->ProgressCallbackClientData = 0; this->ProgressCallbackClientData = 0;