summaryrefslogtreecommitdiffstats
path: root/Source/cmSetCommand.cxx
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2008-01-18 20:52:54 (GMT)
committerAlexander Neundorf <neundorf@kde.org>2008-01-18 20:52:54 (GMT)
commitfc8ce174334c3c33141d37ff2b86ea50226b7ce4 (patch)
tree1f911b47f1b323c1c8250cd6cc89c427c87e0860 /Source/cmSetCommand.cxx
parente5a4da5b3c930bf19710db638f3d1b86ccbfb3aa (diff)
downloadCMake-fc8ce174334c3c33141d37ff2b86ea50226b7ce4.zip
CMake-fc8ce174334c3c33141d37ff2b86ea50226b7ce4.tar.gz
CMake-fc8ce174334c3c33141d37ff2b86ea50226b7ce4.tar.bz2
ENH: remove RAISE_SCOPE() again and instead add SET(<var> <value> PARENT_SCOPE)
Alex
Diffstat (limited to 'Source/cmSetCommand.cxx')
-rw-r--r--Source/cmSetCommand.cxx47
1 files changed, 37 insertions, 10 deletions
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index ffa2ce0..082dd41 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -74,29 +74,42 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args)
std::string value; // optional
bool cache = false; // optional
bool force = false; // optional
+ bool parentScope = false;
cmCacheManager::CacheEntryType type
= cmCacheManager::STRING; // required if cache
const char* docstring = 0; // required if cache
std::string::size_type cacheStart = 0;
- // look for FORCE argument
- if (args.size() > 4 && args[args.size()-1] == "FORCE")
+ unsigned int ignoreLastArgs = 0;
+ // look for PARENT_SCOPE argument
+ if (args.size() > 1 && args[args.size()-1] == "PARENT_SCOPE")
{
- force = true;
+ parentScope = true;
+ ignoreLastArgs++;
}
-
- // check for cache signature
- if (args.size() > 3 && args[args.size() - 3 - (force ? 1 : 0)] == "CACHE")
+ else
{
- cache = true;
+ // look for FORCE argument
+ if (args.size() > 4 && args[args.size()-1] == "FORCE")
+ {
+ force = true;
+ ignoreLastArgs++;
+ }
+
+ // check for cache signature
+ if (args.size() > 3 && args[args.size() - 3 - (force ? 1 : 0)] == "CACHE")
+ {
+ cache = true;
+ ignoreLastArgs+=3;
+ }
}
-
+
// collect any values into a single semi-colon seperated value list
if(static_cast<unsigned short>(args.size()) >
- static_cast<unsigned short>(1 + (cache ? 3 : 0) + (force ? 1 : 0)))
+ static_cast<unsigned short>(1 + ignoreLastArgs))
{
value = args[1];
- size_t endPos = args.size() - (cache ? 3 : 0) - (force ? 1 : 0);
+ size_t endPos = args.size() - ignoreLastArgs;
for(size_t i = 2; i < endPos; ++i)
{
value += ";";
@@ -104,6 +117,20 @@ bool cmSetCommand::InitialPass(std::vector<std::string> const& args)
}
}
+ if (parentScope)
+ {
+ if (value.empty())
+ {
+ this->Makefile->RaiseScope(variable, 0);
+ }
+ else
+ {
+ this->Makefile->RaiseScope(variable, value.c_str());
+ }
+ return true;
+ }
+
+
// we should be nice and try to catch some simple screwups if the last or
// next to last args are CACHE then they screwed up. If they used FORCE
// without CACHE they screwed up