summaryrefslogtreecommitdiffstats
path: root/Source/cmSetCommand.cxx
diff options
context:
space:
mode:
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