[Cmake-commits] CMake branch, next, updated. v2.8.12.1-5131-g9cbfb82

Daniele E. Domenichelli daniele.domenichelli at gmail.com
Wed Nov 13 11:33:54 EST 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  9cbfb82e873f1c3cc454da2482d163d7e7a7e4f0 (commit)
       via  bf755c7c381d8d7d84578bf2dc4ac673aefa090a (commit)
       via  bc280f1c8108809abed700c2fe039340bb9ae1c0 (commit)
       via  20afbd5e037a0ccfa55af8564ed8cd3ec2430540 (commit)
      from  9628802de3783ebf22600afda108e8356953d9f6 (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=9cbfb82e873f1c3cc454da2482d163d7e7a7e4f0
commit 9cbfb82e873f1c3cc454da2482d163d7e7a7e4f0
Merge: 9628802 bf755c7
Author:     Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
AuthorDate: Wed Nov 13 11:33:50 2013 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Nov 13 11:33:50 2013 -0500

    Merge topic 'set_emptyvar_PARENT_SCOPE' into next
    
    bf755c7 set: Add unit tests for set/unset PARENT_SCOPE
    bc280f1 set: Fix handling of empty value with PARENT_SCOPE
    20afbd5 set: Handle value-less PARENT_SCOPE explicitly


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bf755c7c381d8d7d84578bf2dc4ac673aefa090a
commit bf755c7c381d8d7d84578bf2dc4ac673aefa090a
Author:     Daniele E. Domenichelli <daniele.domenichelli at iit.it>
AuthorDate: Wed Nov 13 09:18:18 2013 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Nov 13 10:18:38 2013 -0500

    set: Add unit tests for set/unset PARENT_SCOPE
    
    Create a RunCMake.set test to cover set() command cases, starting with
    PARENT_SCOPE.

diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index bf3dcc1..bb1b909 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -107,6 +107,7 @@ add_RunCMake_test(list)
 add_RunCMake_test(message)
 add_RunCMake_test(string)
 add_RunCMake_test(try_compile)
+add_RunCMake_test(set)
 add_RunCMake_test(variable_watch)
 add_RunCMake_test(CMP0004)
 add_RunCMake_test(TargetPolicies)
diff --git a/Tests/RunCMake/set/CMakeLists.txt b/Tests/RunCMake/set/CMakeLists.txt
new file mode 100644
index 0000000..4b3de84
--- /dev/null
+++ b/Tests/RunCMake/set/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8.12)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/set/PARENT_SCOPE-result.txt b/Tests/RunCMake/set/PARENT_SCOPE-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/set/PARENT_SCOPE-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/set/PARENT_SCOPE.cmake b/Tests/RunCMake/set/PARENT_SCOPE.cmake
new file mode 100644
index 0000000..9bd6bca
--- /dev/null
+++ b/Tests/RunCMake/set/PARENT_SCOPE.cmake
@@ -0,0 +1,33 @@
+set(FOO )
+set(BAR "bar")
+set(BAZ "baz")
+set(BOO "boo")
+
+function(_parent_scope)
+    set(FOO "foo" PARENT_SCOPE)
+    set(BAR "" PARENT_SCOPE)
+    set(BAZ PARENT_SCOPE)
+    unset(BOO PARENT_SCOPE)
+endfunction()
+
+_parent_scope()
+
+if(NOT DEFINED FOO)
+  message(FATAL_ERROR "FOO not defined")
+elseif(NOT "${FOO}" STREQUAL "foo")
+  message(FATAL_ERROR "FOO should be \"foo\", not \"${FOO}\"")
+endif()
+
+if(NOT DEFINED BAR)
+  message(FATAL_ERROR "BAR not defined")
+elseif(NOT "${BAR}" STREQUAL "")
+  message(FATAL_ERROR "BAR should be an empty string, not \"${BAR}\"")
+endif()
+
+if(DEFINED BAZ)
+  message(FATAL_ERROR "BAZ defined")
+endif()
+
+if(DEFINED BOO)
+  message(FATAL_ERROR "BOO defined")
+endif()
diff --git a/Tests/RunCMake/set/RunCMakeTest.cmake b/Tests/RunCMake/set/RunCMakeTest.cmake
new file mode 100644
index 0000000..5d036e3
--- /dev/null
+++ b/Tests/RunCMake/set/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(PARENT_SCOPE)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bc280f1c8108809abed700c2fe039340bb9ae1c0
commit bc280f1c8108809abed700c2fe039340bb9ae1c0
Author:     Daniele E. Domenichelli <daniele.domenichelli at iit.it>
AuthorDate: Wed Nov 13 09:02:56 2013 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Nov 13 10:15:56 2013 -0500

    set: Fix handling of empty value with PARENT_SCOPE
    
    Just as
    
      set(VAR "")
    
    sets VAR to an empty string in the current scope, the code
    
      set(VAR "" PARENT_SCOPE)
    
    is documented to set the variable to an empty string in the parent
    scope.  Fix the implementation to make it so.

diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index 22b4383..bb193bf 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -122,15 +122,8 @@ bool cmSetCommand
 
   if (parentScope)
     {
-    if (value.empty())
-      {
-      this->Makefile->RaiseScope(variable, 0);
-      }
-    else
-      {
-      this->Makefile->RaiseScope(variable, value.c_str());
-      }
-      return true;
+    this->Makefile->RaiseScope(variable, value.c_str());
+    return true;
     }
 
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=20afbd5e037a0ccfa55af8564ed8cd3ec2430540
commit 20afbd5e037a0ccfa55af8564ed8cd3ec2430540
Author:     Daniele E. Domenichelli <daniele.domenichelli at iit.it>
AuthorDate: Wed Nov 13 08:59:26 2013 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Nov 13 10:14:21 2013 -0500

    set: Handle value-less PARENT_SCOPE explicitly
    
    The code "set(VAR PARENT_SCOPE)" unsets VAR in the parent scope.
    Implement this case explicitly next to where "set(VAR)" is explicitly
    handled to unset VAR in the current scope.

diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index 20f38be..22b4383 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -62,9 +62,17 @@ bool cmSetCommand
     this->Makefile->RemoveDefinition(args[0].c_str());
     return true;
     }
+  // SET (VAR PARENT_SCOPE) // Removes the definition of VAR
+                            // in the parent scope.
+  else if (args.size() == 2 && args[args.size()-1] == "PARENT_SCOPE")
+    {
+    this->Makefile->RaiseScope(variable, 0);
+    return true;
+    }
 
   // here are the remaining options
   //  SET (VAR value )
+  //  SET (VAR value PARENT_SCOPE)
   //  SET (VAR CACHE TYPE "doc String" [FORCE])
   //  SET (VAR value CACHE TYPE "doc string" [FORCE])
   std::string value;  // optional

-----------------------------------------------------------------------

Summary of changes:
 Source/cmSetCommand.cxx                            |   19 ++++++-----
 Tests/RunCMake/CMakeLists.txt                      |    1 +
 Tests/RunCMake/{CMP0004 => set}/CMakeLists.txt     |    2 +-
 .../PARENT_SCOPE-result.txt}                       |    0
 Tests/RunCMake/set/PARENT_SCOPE.cmake              |   33 ++++++++++++++++++++
 Tests/RunCMake/set/RunCMakeTest.cmake              |    3 ++
 6 files changed, 48 insertions(+), 10 deletions(-)
 copy Tests/RunCMake/{CMP0004 => set}/CMakeLists.txt (61%)
 copy Tests/RunCMake/{CMP0022/CMP0022-WARN-empty-old-result.txt => set/PARENT_SCOPE-result.txt} (100%)
 create mode 100644 Tests/RunCMake/set/PARENT_SCOPE.cmake
 create mode 100644 Tests/RunCMake/set/RunCMakeTest.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list