diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 2d407189b..34ca68d4a 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -84,6 +84,19 @@ const char* cmDefinitions::Set(const char* key, const char* value) return def.Exists? def.c_str() : 0; } +//---------------------------------------------------------------------------- +std::set cmDefinitions::LocalKeys() const +{ + std::set keys; + // Consider local definitions. + for(MapType::const_iterator mi = this->Map.begin(); + mi != this->Map.end(); ++mi) + { + keys.insert(mi->first); + } + return keys; +} + //---------------------------------------------------------------------------- cmDefinitions cmDefinitions::Closure() const { diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index e385e8887..4834d8443 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -40,6 +40,9 @@ public: /** Set (or unset if null) a value associated with a key. */ const char* Set(const char* key, const char* value); + /** Get the set of all local keys. */ + std::set LocalKeys() const; + /** Compute the closure of all defined keys with values. This flattens the scope. The result has no parent. */ cmDefinitions Closure() const;