From ed4f14fb4252b10db80ca8c6f04e427957ff8871 Mon Sep 17 00:00:00 2001 From: Ken Martin Date: Tue, 1 May 2001 16:28:32 -0400 Subject: [PATCH] added method to puch cache into makefile defines --- Source/cmCacheManager.cxx | 16 ++++++++++++++++ Source/cmCacheManager.h | 3 +++ 2 files changed, 19 insertions(+) diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index d3da82f7b..e8ec10ec0 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -136,6 +136,22 @@ bool cmCacheManager::LoadCache(const char* path) return true; } +void cmCacheManager::DefineCache(cmMakefile *mf) +{ + if (!mf) + { + return; + } + + // add definition to the makefile + for( std::map::const_iterator i = m_Cache.begin(); + i != m_Cache.end(); ++i) + { + const CacheEntry& ce = (*i).second; + mf->AddDefinition((*i).first.c_str(), ce.m_Value.c_str()); + } +} + bool cmCacheManager::SaveCache(cmMakefile* mf) const { return this->SaveCache(mf->GetHomeOutputDirectory()); diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 91676ab06..6ecb37b75 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -78,6 +78,9 @@ public: bool LoadCache(cmMakefile*); //! Load a cache for given makefile. Loads from path/CMakeCache.txt. bool LoadCache(const char* path); + + //! Put cache definitions into makefile + void DefineCache(cmMakefile*); //! Save cache for given makefile. Saves to ouput home CMakeCache.txt. bool SaveCache(cmMakefile*) const;