summaryrefslogtreecommitdiffstats
path: root/Source/cmDefinitions.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-05-17 11:21:02 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-05-19 20:36:51 (GMT)
commitea7b962be2f157f60f143725948e56b2f9f07042 (patch)
treeb76cc40154964fa0853a6aa71ae814737b034da8 /Source/cmDefinitions.cxx
parentc8cb66880c233414b6656ea3d23776f9ba07a4e4 (diff)
downloadCMake-ea7b962be2f157f60f143725948e56b2f9f07042.zip
CMake-ea7b962be2f157f60f143725948e56b2f9f07042.tar.gz
CMake-ea7b962be2f157f60f143725948e56b2f9f07042.tar.bz2
cmMakefile: Raise variable in scope explicitly when needed.
The Get method implicitly pulls a copy of all variables into a local scope. This is not necessary.
Diffstat (limited to 'Source/cmDefinitions.cxx')
-rw-r--r--Source/cmDefinitions.cxx16
1 files changed, 13 insertions, 3 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)
{