diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2003-03-06 16:19:28 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2003-03-06 16:19:28 (GMT) |
commit | ce750180baec52f1bb64fbd1afe7c1aff1338c5c (patch) | |
tree | 2f7f0b39ebd08222176ff10bcc8516d6a067dbad /Source/cmMakefile.cxx | |
parent | 6631d787541c9cf72821ad033a6f42356cf9f2e6 (diff) | |
download | CMake-ce750180baec52f1bb64fbd1afe7c1aff1338c5c.zip CMake-ce750180baec52f1bb64fbd1afe7c1aff1338c5c.tar.gz CMake-ce750180baec52f1bb64fbd1afe7c1aff1338c5c.tar.bz2 |
Add method which returns a list of all variables
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b386041..4a9ef30 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -976,6 +976,32 @@ const char* cmMakefile::GetDefinition(const char* name) const return def; } +std::vector<std::string> cmMakefile::GetDefinitions(int cacheonly /* = 0 */) const +{ + std::map<std::string, int> definitions; + if ( !cacheonly ) + { + DefinitionMap::const_iterator it; + for ( it = m_Definitions.begin(); it != m_Definitions.end(); it ++ ) + { + definitions[it->first] = 1; + } + } + cmCacheManager::CacheIterator cit = this->GetCacheManager()->GetCacheIterator(); + for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() ) + { + definitions[cit.GetName()] = 1; + } + + std::vector<std::string> res; + + std::map<std::string, int>::iterator fit; + for ( fit = definitions.begin(); fit != definitions.end(); fit ++ ) + { + res.push_back(fit->first); + } + return res; +} const char *cmMakefile::ExpandVariablesInString(std::string& source) const |