[Cmake-commits] CMake branch, next, updated. v2.8.12-3705-g861bc91
Brad King
brad.king at kitware.com
Tue Oct 8 11:22:19 EDT 2013
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 861bc9194d3e440e631d42edee08e45bffe201d9 (commit)
via 261c248254faf2fc09d71f456f018b7f8bc9a7f1 (commit)
from 363a04feb8bc3e7a3db33d2f1e6ae76c2d4a2eb9 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=861bc9194d3e440e631d42edee08e45bffe201d9
commit 861bc9194d3e440e631d42edee08e45bffe201d9
Merge: 363a04f 261c248
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Oct 8 11:22:17 2013 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Oct 8 11:22:17 2013 -0400
Merge topic 'unset-PARENT_SCOPE' into next
261c248 unset: Add PARENT_SCOPE option
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=261c248254faf2fc09d71f456f018b7f8bc9a7f1
commit 261c248254faf2fc09d71f456f018b7f8bc9a7f1
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Oct 8 08:37:47 2013 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue Oct 8 08:37:50 2013 -0400
unset: Add PARENT_SCOPE option
Add an unset() command option to remove a variable from the calling
scope, just like the set() command's PARENT_SCOPE option. Teach the
Unset test to cover such cases.
diff --git a/Source/cmUnsetCommand.cxx b/Source/cmUnsetCommand.cxx
index 5c0cfaa..84f3029 100644
--- a/Source/cmUnsetCommand.cxx
+++ b/Source/cmUnsetCommand.cxx
@@ -49,7 +49,13 @@ bool cmUnsetCommand::InitialPass(std::vector<std::string> const& args,
this->Makefile->RemoveCacheDefinition(variable);
return true;
}
- // ERROR: second argument isn't CACHE
+ // unset(VAR PARENT_SCOPE)
+ else if ((args.size() == 2) && (args[1] == "PARENT_SCOPE"))
+ {
+ this->Makefile->RaiseScope(variable, 0);
+ return true;
+ }
+ // ERROR: second argument isn't CACHE or PARENT_SCOPE
else
{
this->SetError("called with an invalid second argument");
diff --git a/Source/cmUnsetCommand.h b/Source/cmUnsetCommand.h
index 9cf95d9..a477f19 100644
--- a/Source/cmUnsetCommand.h
+++ b/Source/cmUnsetCommand.h
@@ -61,10 +61,13 @@ public:
virtual const char* GetFullDocumentation() const
{
return
- " unset(<variable> [CACHE])\n"
+ " unset(<variable> [CACHE | PARENT_SCOPE])\n"
"Removes the specified variable causing it to become undefined. "
"If CACHE is present then the variable is removed from the cache "
"instead of the current scope.\n"
+ "If PARENT_SCOPE is present then the variable is removed from the "
+ "scope above the current scope. See the same option in the set() "
+ "command for further details.\n"
"<variable> can be an environment variable such as:\n"
" unset(ENV{LD_LIBRARY_PATH})\n"
"in which case the variable will be removed from the current "
diff --git a/Tests/Unset/CMakeLists.txt b/Tests/Unset/CMakeLists.txt
index 781da3f..07aa68e 100644
--- a/Tests/Unset/CMakeLists.txt
+++ b/Tests/Unset/CMakeLists.txt
@@ -51,5 +51,32 @@ if(DEFINED BAR)
message(FATAL_ERROR "BAR still defined")
endif()
+# Test unset(... PARENT_SCOPE)
+function(unset_zots)
+ if(NOT DEFINED ZOT1)
+ message(FATAL_ERROR "ZOT1 is not defined inside function")
+ endif()
+ if(NOT DEFINED ZOT2)
+ message(FATAL_ERROR "ZOT2 is not defined inside function")
+ endif()
+ unset(ZOT1)
+ unset(ZOT2 PARENT_SCOPE)
+ if(DEFINED ZOT1)
+ message(FATAL_ERROR "ZOT1 is defined inside function after unset")
+ endif()
+ if(NOT DEFINED ZOT2)
+ message(FATAL_ERROR
+ "ZOT2 is not defined inside function after unset(... PARENT_SCOPE)")
+ endif()
+endfunction()
+set(ZOT1 1)
+set(ZOT2 2)
+unset_zots()
+if(NOT DEFINED ZOT1)
+ message(FATAL_ERROR "ZOT1 is not still defined after function")
+endif()
+if(DEFINED ZOT2)
+ message(FATAL_ERROR "ZOT2 is still defined after function unset PARENT_SCOPE")
+endif()
add_executable(Unset unset.c)
-----------------------------------------------------------------------
Summary of changes:
Source/cmUnsetCommand.cxx | 8 +++++++-
Source/cmUnsetCommand.h | 5 ++++-
Tests/Unset/CMakeLists.txt | 27 +++++++++++++++++++++++++++
3 files changed, 38 insertions(+), 2 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list