[cmake-commits] alex committed cmBootstrapCommands.cxx 1.21 1.22
cmRaiseScopeCommand.cxx 1.2 NONE cmRaiseScopeCommand.h 1.2 NONE
cmSetCommand.cxx 1.30 1.31 cmSetCommand.h 1.18 1.19
cmake-commits at cmake.org
cmake-commits at cmake.org
Fri Jan 18 15:52:55 EST 2008
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv32005/Source
Modified Files:
cmBootstrapCommands.cxx cmSetCommand.cxx cmSetCommand.h
Removed Files:
cmRaiseScopeCommand.cxx cmRaiseScopeCommand.h
Log Message:
ENH: remove RAISE_SCOPE() again and instead add SET(<var> <value> PARENT_SCOPE)
Alex
--- cmRaiseScopeCommand.h DELETED ---
--- cmRaiseScopeCommand.cxx DELETED ---
Index: cmSetCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmSetCommand.cxx,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- cmSetCommand.cxx 1 Aug 2006 15:38:41 -0000 1.30
+++ cmSetCommand.cxx 18 Jan 2008 20:52:53 -0000 1.31
@@ -74,29 +74,42 @@
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 @@
}
}
+ 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
Index: cmBootstrapCommands.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmBootstrapCommands.cxx,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- cmBootstrapCommands.cxx 17 Jan 2008 20:54:49 -0000 1.21
+++ cmBootstrapCommands.cxx 18 Jan 2008 20:52:53 -0000 1.22
@@ -70,7 +70,6 @@
#include "cmMessageCommand.cxx"
#include "cmOptionCommand.cxx"
#include "cmProjectCommand.cxx"
-#include "cmRaiseScopeCommand.cxx"
#include "cmSetCommand.cxx"
#include "cmSetPropertyCommand.cxx"
#include "cmSetSourceFilesPropertiesCommand.cxx"
@@ -130,7 +129,6 @@
commands.push_back(new cmMessageCommand);
commands.push_back(new cmOptionCommand);
commands.push_back(new cmProjectCommand);
- commands.push_back(new cmRaiseScopeCommand);
commands.push_back(new cmSetCommand);
commands.push_back(new cmSetPropertyCommand);
commands.push_back(new cmSetSourceFilesPropertiesCommand);
Index: cmSetCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmSetCommand.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- cmSetCommand.h 20 Dec 2007 22:49:38 -0000 1.18
+++ cmSetCommand.h 18 Jan 2008 20:52:53 -0000 1.19
@@ -65,7 +65,8 @@
virtual const char* GetFullDocumentation()
{
return
- " set(<variable> <value> [CACHE <type> <docstring> [FORCE]])\n"
+ " set(<variable> <value> [[CACHE <type> <docstring> [FORCE]] | "
+ "PARENT_SCOPE])\n"
"Within CMake sets <variable> to the value <value>. <value> is expanded"
" before <variable> is set to it. If CACHE is present, then the "
"<variable> is put in the cache. <type> and <docstring> are then "
@@ -81,6 +82,12 @@
"cache variable, then this always writes into the current makefile. The "
"FORCE option will overwrite the cache value removing any changes by "
"the user.\n"
+ "If PARENT_SCOPE is present, the variable will be set in the scope "
+ "above the current scope. Each new directory or function creates a new "
+ "scope. This command will set the value of a variable into the parent "
+ "directory or calling function (whichever is applicable to the case at "
+ "hand) If VALUE is not specified then the variable is removed from the "
+ "parent scope.\n"
" set(<variable> <value1> ... <valueN>)\n"
"In this case <variable> is set to a semicolon separated list of "
"values.\n"
More information about the Cmake-commits
mailing list