summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/cmDefinitions.cxx16
-rw-r--r--Source/cmDefinitions.h6
-rw-r--r--Source/cmMakefile.cxx2
3 files changed, 17 insertions, 7 deletions
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index e2c6876..d7b6279 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -18,7 +18,7 @@ cmDefinitions::Def cmDefinitions::NoDef;
//----------------------------------------------------------------------------
cmDefinitions::Def const& cmDefinitions::GetInternal(
- const std::string& key, StackIter begin, StackIter end)
+ const std::string& key, StackIter begin, StackIter end, bool raise)
{
assert(begin != end);
MapType::const_iterator i = begin->Map.find(key);
@@ -32,7 +32,11 @@ cmDefinitions::Def const& cmDefinitions::GetInternal(
{
return cmDefinitions::NoDef;
}
- Def const& def = cmDefinitions::GetInternal(key, it, end);
+ Def const& def = cmDefinitions::GetInternal(key, it, end, raise);
+ if (!raise)
+ {
+ return def;
+ }
return begin->Map.insert(MapType::value_type(key, def)).first->second;
}
@@ -40,10 +44,16 @@ cmDefinitions::Def const& cmDefinitions::GetInternal(
const char* cmDefinitions::Get(const std::string& key,
StackIter begin, StackIter end)
{
- Def const& def = cmDefinitions::GetInternal(key, begin, end);
+ Def const& def = cmDefinitions::GetInternal(key, begin, end, false);
return def.Exists? def.c_str() : 0;
}
+void cmDefinitions::Raise(const std::string& key,
+ StackIter begin, StackIter end)
+{
+ cmDefinitions::GetInternal(key, begin, end, true);
+}
+
//----------------------------------------------------------------------------
void cmDefinitions::Set(const std::string& key, const char* value)
{
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h
index bf791ed..17b9c7c 100644
--- a/Source/cmDefinitions.h
+++ b/Source/cmDefinitions.h
@@ -35,11 +35,11 @@ class cmDefinitions
typedef std::list<cmDefinitions>::reverse_iterator StackIter;
typedef std::list<cmDefinitions>::const_reverse_iterator StackConstIter;
public:
- /** Get the value associated with a key; null if none.
- Store the result locally if it came from a parent. */
static const char* Get(const std::string& key,
StackIter begin, StackIter end);
+ static void Raise(const std::string& key, StackIter begin, StackIter end);
+
/** Set (or unset if null) a value associated with a key. */
void Set(const std::string& key, const char* value);
@@ -80,7 +80,7 @@ private:
MapType Map;
static Def const& GetInternal(const std::string& key,
- StackIter begin, StackIter end);
+ StackIter begin, StackIter end, bool raise);
};
#endif
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 21c9f47..adba110 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -130,7 +130,7 @@ public:
return true;
}
// First localize the definition in the current scope.
- this->GetDefinition(var);
+ cmDefinitions::Raise(var, this->VarStack.rbegin(), this->VarStack.rend());
// Now update the definition in the parent scope.
it->Set(var, varDef);