[Cmake-commits] CMake branch, next, updated. v3.0.0-rc5-3321-g1fb7afd

Ben Boeckel ben.boeckel at kitware.com
Thu May 22 11:13:39 EDT 2014


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  1fb7afd70b23d3260a91c378f7d16c52ae469d1e (commit)
       via  9ba91463e61b1e4ff5b3dcdea82981f65097e7dd (commit)
      from  fb5f018c0321375c9a8427fa0a60b03f1dab4440 (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=1fb7afd70b23d3260a91c378f7d16c52ae469d1e
commit 1fb7afd70b23d3260a91c378f7d16c52ae469d1e
Merge: fb5f018 9ba9146
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Thu May 22 11:13:38 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu May 22 11:13:38 2014 -0400

    Merge topic 'dev/CMP0053-variable_watch' into next
    
    9ba91463 tests: test CMP0053 in WARN mode when watching variables


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9ba91463e61b1e4ff5b3dcdea82981f65097e7dd
commit 9ba91463e61b1e4ff5b3dcdea82981f65097e7dd
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Tue May 20 17:00:28 2014 -0400
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Thu May 22 11:13:29 2014 -0400

    tests: test CMP0053 in WARN mode when watching variables
    
    When CMP0053 is in WARN mode, variables get expanded twice, leaking the
    fact that the string was expanded twice and changing behavior. Instead,
    suppress variable watches when running the expansion to trigger the
    CMP0053 warning.

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 9f33b92..3510dcb 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -103,6 +103,7 @@ cmMakefile::cmMakefile(): Internal(new Internals)
   this->GeneratingBuildSystem = false;
 
   this->NumLastMatches = 0;
+  this->SuppressWatches = false;
 }
 
 cmMakefile::cmMakefile(const cmMakefile& mf): Internal(new Internals)
@@ -153,6 +154,7 @@ cmMakefile::cmMakefile(const cmMakefile& mf): Internal(new Internals)
   this->OutputToSource = mf.OutputToSource;
 
   this->NumLastMatches = mf.NumLastMatches;
+  this->SuppressWatches = mf.SuppressWatches;
 }
 
 //----------------------------------------------------------------------------
@@ -2463,7 +2465,7 @@ const char* cmMakefile::GetDefinition(const std::string& name) const
     }
 #ifdef CMAKE_BUILD_WITH_CMAKE
   cmVariableWatch* vv = this->GetVariableWatch();
-  if ( vv )
+  if ( vv && !this->SuppressWatches )
     {
     if ( def )
       {
@@ -2570,10 +2572,14 @@ const char *cmMakefile::ExpandVariablesInString(std::string& source,
       original = source;
       newResult = source;
       compareResults = true;
+      // Suppress variable watches to avoid calling hooks twice. Suppress new
+      // dereferences since the OLD behavior is still what is actually used.
+      this->SuppressWatches = true;
       newError =
         ExpandVariablesInStringNew(newErrorstr, newResult, escapeQuotes,
                                    noEscapes, atOnly, filename, line,
                                    removeEmpty, replaceAt);
+      this->SuppressWatches = false;
       }
     case cmPolicies::OLD:
       mtype = ExpandVariablesInStringOld(errorstr, source, escapeQuotes,
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 11904a6..9a4b9c7 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -1127,6 +1127,8 @@ private:
                              const std::string& feature) const;
   bool HaveCxxFeatureAvailable(cmTarget const* target,
                                const std::string& feature) const;
+
+  mutable bool SuppressWatches;
 };
 
 //----------------------------------------------------------------------------
diff --git a/Tests/RunCMake/CMP0053/CMP0053-NEW-stderr.txt b/Tests/RunCMake/CMP0053/CMP0053-NEW-stderr.txt
new file mode 100644
index 0000000..836b0ff
--- /dev/null
+++ b/Tests/RunCMake/CMP0053/CMP0053-NEW-stderr.txt
@@ -0,0 +1,2 @@
+^called
+--><--$
diff --git a/Tests/RunCMake/CMP0053/CMP0053-NEW.cmake b/Tests/RunCMake/CMP0053/CMP0053-NEW.cmake
new file mode 100644
index 0000000..6ffedc6
--- /dev/null
+++ b/Tests/RunCMake/CMP0053/CMP0053-NEW.cmake
@@ -0,0 +1,8 @@
+cmake_policy(SET CMP0053 NEW)
+
+function (watch_callback)
+  message("called")
+endfunction ()
+
+variable_watch(test watch_callback)
+message("-->${test}<--")
diff --git a/Tests/RunCMake/CMP0053/CMP0053-OLD-stderr.txt b/Tests/RunCMake/CMP0053/CMP0053-OLD-stderr.txt
new file mode 100644
index 0000000..836b0ff
--- /dev/null
+++ b/Tests/RunCMake/CMP0053/CMP0053-OLD-stderr.txt
@@ -0,0 +1,2 @@
+^called
+--><--$
diff --git a/Tests/RunCMake/CMP0053/CMP0053-OLD.cmake b/Tests/RunCMake/CMP0053/CMP0053-OLD.cmake
new file mode 100644
index 0000000..41f5347
--- /dev/null
+++ b/Tests/RunCMake/CMP0053/CMP0053-OLD.cmake
@@ -0,0 +1,8 @@
+cmake_policy(SET CMP0053 OLD)
+
+function (watch_callback)
+  message("called")
+endfunction ()
+
+variable_watch(test watch_callback)
+message("-->${test}<--")
diff --git a/Tests/RunCMake/CMP0053/CMP0053-WARN-stderr.txt b/Tests/RunCMake/CMP0053/CMP0053-WARN-stderr.txt
new file mode 100644
index 0000000..836b0ff
--- /dev/null
+++ b/Tests/RunCMake/CMP0053/CMP0053-WARN-stderr.txt
@@ -0,0 +1,2 @@
+^called
+--><--$
diff --git a/Tests/RunCMake/CMP0053/CMP0053-WARN.cmake b/Tests/RunCMake/CMP0053/CMP0053-WARN.cmake
new file mode 100644
index 0000000..b010d13
--- /dev/null
+++ b/Tests/RunCMake/CMP0053/CMP0053-WARN.cmake
@@ -0,0 +1,6 @@
+function (watch_callback)
+  message("called")
+endfunction ()
+
+variable_watch(test watch_callback)
+message("-->${test}<--")
diff --git a/Tests/RunCMake/CMP0053/CMakeLists.txt b/Tests/RunCMake/CMP0053/CMakeLists.txt
new file mode 100644
index 0000000..3482e6b
--- /dev/null
+++ b/Tests/RunCMake/CMP0053/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.0)
+project(${RunCMake_TEST} CXX)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0053/RunCMakeTest.cmake b/Tests/RunCMake/CMP0053/RunCMakeTest.cmake
new file mode 100644
index 0000000..6521ac0
--- /dev/null
+++ b/Tests/RunCMake/CMP0053/RunCMakeTest.cmake
@@ -0,0 +1,5 @@
+include(RunCMake)
+
+run_cmake(CMP0053-OLD)
+run_cmake(CMP0053-NEW)
+run_cmake(CMP0053-WARN)
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 4efc73a..165f027 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -35,6 +35,7 @@ add_RunCMake_test(CMP0046)
 add_RunCMake_test(CMP0049)
 add_RunCMake_test(CMP0050)
 add_RunCMake_test(CMP0051)
+add_RunCMake_test(CMP0053)
 add_RunCMake_test(CTest)
 if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles")
   add_RunCMake_test(CompilerChange)

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

Summary of changes:
 Source/cmMakefile.cxx                              |    8 +++++++-
 Source/cmMakefile.h                                |    2 ++
 Tests/RunCMake/CMP0053/CMP0053-NEW-stderr.txt      |    2 ++
 Tests/RunCMake/CMP0053/CMP0053-NEW.cmake           |    8 ++++++++
 Tests/RunCMake/CMP0053/CMP0053-OLD-stderr.txt      |    2 ++
 Tests/RunCMake/CMP0053/CMP0053-OLD.cmake           |    8 ++++++++
 Tests/RunCMake/CMP0053/CMP0053-WARN-stderr.txt     |    2 ++
 Tests/RunCMake/CMP0053/CMP0053-WARN.cmake          |    6 ++++++
 Tests/RunCMake/{CMP0051 => CMP0053}/CMakeLists.txt |    0
 Tests/RunCMake/CMP0053/RunCMakeTest.cmake          |    5 +++++
 Tests/RunCMake/CMakeLists.txt                      |    1 +
 11 files changed, 43 insertions(+), 1 deletion(-)
 create mode 100644 Tests/RunCMake/CMP0053/CMP0053-NEW-stderr.txt
 create mode 100644 Tests/RunCMake/CMP0053/CMP0053-NEW.cmake
 create mode 100644 Tests/RunCMake/CMP0053/CMP0053-OLD-stderr.txt
 create mode 100644 Tests/RunCMake/CMP0053/CMP0053-OLD.cmake
 create mode 100644 Tests/RunCMake/CMP0053/CMP0053-WARN-stderr.txt
 create mode 100644 Tests/RunCMake/CMP0053/CMP0053-WARN.cmake
 copy Tests/RunCMake/{CMP0051 => CMP0053}/CMakeLists.txt (100%)
 create mode 100644 Tests/RunCMake/CMP0053/RunCMakeTest.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list