cmMakefile: Simplify GetDefinitions implementation.

This commit is contained in:
Stephen Kelly 2015-04-06 12:30:21 +02:00
parent d3823263b2
commit 97c50a8dbd
1 changed files with 6 additions and 6 deletions

View File

@ -2501,20 +2501,20 @@ const char* cmMakefile::GetSafeDefinition(const std::string& def) const
std::vector<std::string> cmMakefile std::vector<std::string> cmMakefile
::GetDefinitions(int cacheonly /* = 0 */) const ::GetDefinitions(int cacheonly /* = 0 */) const
{ {
std::set<std::string> definitions; std::vector<std::string> res;
if ( !cacheonly ) if ( !cacheonly )
{ {
definitions = this->Internal->VarStack.top().ClosureKeys(); std::set<std::string> definitions =
this->Internal->VarStack.top().ClosureKeys();
res.insert(res.end(), definitions.begin(), definitions.end());
} }
cmCacheManager::CacheIterator cit = cmCacheManager::CacheIterator cit =
this->GetCacheManager()->GetCacheIterator(); this->GetCacheManager()->GetCacheIterator();
for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() ) for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() )
{ {
definitions.insert(cit.GetName()); res.push_back(cit.GetName());
} }
std::sort(res.begin(), res.end());
std::vector<std::string> res;
res.insert(res.end(), definitions.begin(), definitions.end());
return res; return res;
} }