[Cmake-commits] CMake branch, next, updated. v3.1.0-rc2-1017-gd3e8937

Ben Boeckel ben.boeckel at kitware.com
Tue Dec 2 11:45:30 EST 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  d3e89373cca5afb50cdf04f4fba087daa8c70fa4 (commit)
       via  a8a2fde198926b3bac40f34f510fdc821d51e8a4 (commit)
       via  65b164123edf4edaa74c7a0fdd6852f49d098f7c (commit)
      from  6e7305e92f0ddedfe6eedb475d2eafb3f208d26b (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=d3e89373cca5afb50cdf04f4fba087daa8c70fa4
commit d3e89373cca5afb50cdf04f4fba087daa8c70fa4
Merge: 6e7305e a8a2fde
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Tue Dec 2 11:45:28 2014 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Dec 2 11:45:28 2014 -0500

    Merge topic 'cached-regex-clear-fixed' into next
    
    a8a2fde1 fixup! cmMakefile: store the number of last matches in a CMake var
    65b16412 fixup! test: add a test for clearing regex results


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a8a2fde198926b3bac40f34f510fdc821d51e8a4
commit a8a2fde198926b3bac40f34f510fdc821d51e8a4
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Tue Dec 2 11:34:08 2014 -0500
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Tue Dec 2 11:45:14 2014 -0500

    fixup! cmMakefile: store the number of last matches in a CMake var

diff --git a/Help/release/dev/cached-regex-clear-fixed.rst b/Help/release/dev/cached-regex-clear-fixed.rst
new file mode 100644
index 0000000..fbf08cc
--- /dev/null
+++ b/Help/release/dev/cached-regex-clear-fixed.rst
@@ -0,0 +1,5 @@
+cached-regex-clear-fixed
+------------------------
+
+* Add :variable:`CMAKE_MATCH_COUNT` for the number of matches made in the last
+  regular expression.
diff --git a/Help/variable/CMAKE_MATCH_COUNT.rst b/Help/variable/CMAKE_MATCH_COUNT.rst
index 4f7b9ab..8b1c036 100644
--- a/Help/variable/CMAKE_MATCH_COUNT.rst
+++ b/Help/variable/CMAKE_MATCH_COUNT.rst
@@ -3,6 +3,6 @@ CMAKE_MATCH_COUNT
 
 The number of matches with the last regular expression.
 
-When a regular expression match is used, CMake fills in `CMAKE_MATCH_<n>`
-variables with the match contents. The `CMAKE_MATCH_COUNT` variable holds the
-number of match expressions when these are filled.
+When a regular expression match is used, CMake fills in ``CMAKE_MATCH_<n>``
+variables with the match contents. The ``CMAKE_MATCH_COUNT`` variable holds
+the number of match expressions when these are filled.
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 2a8bbd4..24e65d7 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4841,7 +4841,7 @@ std::vector<cmSourceFile*> cmMakefile::GetQtUiFilesWithOptions() const
   return this->QtUiFilesWithOptions;
 }
 
-static std::string matchVariables[] = {
+static std::string const matchVariables[] = {
   "CMAKE_MATCH_0",
   "CMAKE_MATCH_1",
   "CMAKE_MATCH_2",
@@ -4854,7 +4854,7 @@ static std::string matchVariables[] = {
   "CMAKE_MATCH_9"
 };
 
-static std::string nMatchesVariable = "CMAKE_MATCH_COUNT";
+static std::string const nMatchesVariable = "CMAKE_MATCH_COUNT";
 
 //----------------------------------------------------------------------------
 void cmMakefile::ClearMatches()
@@ -4865,7 +4865,7 @@ void cmMakefile::ClearMatches()
     return;
     }
   int nMatches = atoi(nMatchesStr);
-  for (int i=0; i<nMatches; i++)
+  for (int i=0; i<=nMatches; i++)
     {
     std::string const& var = matchVariables[i];
     std::string const& s = this->GetSafeDefinition(var);
@@ -4883,7 +4883,7 @@ void cmMakefile::ClearMatches()
 void cmMakefile::StoreMatches(cmsys::RegularExpression& re)
 {
   char highest = 0;
-  for (unsigned int i=0; i<10; i++)
+  for (int i=0; i<10; i++)
     {
     std::string const& m = re.match(i);
     if(!m.empty())
@@ -4891,7 +4891,7 @@ void cmMakefile::StoreMatches(cmsys::RegularExpression& re)
       std::string const& var = matchVariables[i];
       this->AddDefinition(var, m.c_str());
       this->MarkVariableAsUsed(var);
-      highest = '0' + i + 1;
+      highest = '0' + i;
       }
     }
   char nMatches[] = {highest, '\0'};

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=65b164123edf4edaa74c7a0fdd6852f49d098f7c
commit 65b164123edf4edaa74c7a0fdd6852f49d098f7c
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Tue Dec 2 11:32:11 2014 -0500
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Tue Dec 2 11:44:14 2014 -0500

    fixup! test: add a test for clearing regex results

diff --git a/Tests/RegexClear/CMakeLists.txt b/Tests/RegexClear/CMakeLists.txt
deleted file mode 100644
index 5911b42..0000000
--- a/Tests/RegexClear/CMakeLists.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-cmake_minimum_required (VERSION 3.0)
-project (RegexClear C)
-
-function (check_for_success)
-  if (CMAKE_MATCH_1 STREQUAL "0" AND
-      CMAKE_MATCH_2 STREQUAL "1")
-    message("Matched string properly")
-  else ()
-    message(FATAL_ERROR "Failed to match properly")
-  endif ()
-endfunction ()
-
-function (check_for_failure)
-  if (CMAKE_MATCH_1 STREQUAL "" AND
-      CMAKE_MATCH_2 STREQUAL "")
-    message("Matched nothing properly")
-  else ()
-    message(FATAL_ERROR "Found a match where there should be none")
-  endif ()
-endfunction ()
-
-macro (do_regex_success)
-  string(REGEX MATCH "(0)(1)" output "01")
-  check_for_success()
-endmacro ()
-
-macro (do_regex_failure)
-  string(REGEX MATCH "(0)(1)" output "12")
-  check_for_failure()
-endmacro ()
-
-do_regex_success()
-
-list(INSERT CMAKE_MODULE_PATH 0
-  "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
-find_package(dummy) # Ensure cmMakefile::PushScope/PopScope work.
-
-check_for_failure()
-do_regex_failure()
-do_regex_success()
-
-add_subdirectory(subdir)
-
-check_for_success() # Ensure that the subdir didn't mess with this scope.
-
-add_executable(RegexClear RegexClear.c)
diff --git a/Tests/RegexClear/RegexClear.c b/Tests/RegexClear/RegexClear.c
deleted file mode 100644
index d123e09..0000000
--- a/Tests/RegexClear/RegexClear.c
+++ /dev/null
@@ -1,4 +0,0 @@
-int main(int argc, char** argv)
-{
-  return 0;
-}
diff --git a/Tests/RegexClear/cmake/Finddummy.cmake b/Tests/RegexClear/cmake/Finddummy.cmake
deleted file mode 100644
index 635e362..0000000
--- a/Tests/RegexClear/cmake/Finddummy.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-check_for_success()
-do_regex_failure()
-
-set(dummy_FOUND 1)
diff --git a/Tests/RegexClear/subdir/CMakeLists.txt b/Tests/RegexClear/subdir/CMakeLists.txt
deleted file mode 100644
index 2ed176a..0000000
--- a/Tests/RegexClear/subdir/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-check_for_success()
-do_regex_failure()
diff --git a/Tests/RunCMake/string/RegexClear.cmake b/Tests/RunCMake/string/RegexClear.cmake
new file mode 100644
index 0000000..d5edaac
--- /dev/null
+++ b/Tests/RunCMake/string/RegexClear.cmake
@@ -0,0 +1,54 @@
+cmake_minimum_required (VERSION 3.0)
+project (RegexClear C)
+
+function (output_results msg)
+  message("results from: ${msg}")
+  message("CMAKE_MATCH_0: -->${CMAKE_MATCH_0}<--")
+  message("CMAKE_MATCH_1: -->${CMAKE_MATCH_1}<--")
+  message("CMAKE_MATCH_2: -->${CMAKE_MATCH_2}<--")
+  message("CMAKE_MATCH_COUNT: -->${CMAKE_MATCH_COUNT}<--")
+endfunction ()
+
+function (check_for_success msg)
+  if (CMAKE_MATCH_1 STREQUAL "0" AND
+      CMAKE_MATCH_2 STREQUAL "1")
+    message("Matched string properly")
+  else ()
+    message("Failed to match properly")
+  endif ()
+  output_results("${msg}")
+endfunction ()
+
+function (check_for_failure msg)
+  if (CMAKE_MATCH_1 STREQUAL "" AND
+      CMAKE_MATCH_2 STREQUAL "")
+    message("Matched nothing properly")
+  else ()
+    message("Found a match where there should be none")
+  endif ()
+  output_results("${msg}")
+endfunction ()
+
+macro (do_regex_success msg)
+  string(REGEX MATCH "(0)(1)" output "01")
+  check_for_success("${msg}")
+endmacro ()
+
+macro (do_regex_failure msg)
+  string(REGEX MATCH "(0)(1)" output "12")
+  check_for_failure("${msg}")
+endmacro ()
+
+do_regex_success("setting up initial state")
+
+list(INSERT CMAKE_MODULE_PATH 0
+  "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
+find_package(dummy) # Ensure cmMakefile::PushScope/PopScope work.
+
+check_for_failure("checking after find_package")
+do_regex_failure("clearing out results with a failing match")
+do_regex_success("making a successful match before add_subdirectory")
+
+add_subdirectory(subdir)
+
+check_for_success("ensuring the subdirectory did not interfere with the parent") # Ensure that the subdir didn't mess with this scope.
diff --git a/Tests/RunCMake/string/RunCMakeTest.cmake b/Tests/RunCMake/string/RunCMakeTest.cmake
index e83db27..fc913c6 100644
--- a/Tests/RunCMake/string/RunCMakeTest.cmake
+++ b/Tests/RunCMake/string/RunCMakeTest.cmake
@@ -10,3 +10,5 @@ run_cmake(UuidBadNamespace)
 run_cmake(UuidMissingNameValue)
 run_cmake(UuidMissingTypeValue)
 run_cmake(UuidBadType)
+
+run_cmake(RegexClear)
diff --git a/Tests/RunCMake/string/cmake/Finddummy.cmake b/Tests/RunCMake/string/cmake/Finddummy.cmake
new file mode 100644
index 0000000..4cbc1fb
--- /dev/null
+++ b/Tests/RunCMake/string/cmake/Finddummy.cmake
@@ -0,0 +1,4 @@
+check_for_success("making a match inside of find_package")
+do_regex_failure("making a failure inside of find_package")
+
+set(dummy_FOUND 1)
diff --git a/Tests/RunCMake/string/subdir/CMakeLists.txt b/Tests/RunCMake/string/subdir/CMakeLists.txt
new file mode 100644
index 0000000..5573308
--- /dev/null
+++ b/Tests/RunCMake/string/subdir/CMakeLists.txt
@@ -0,0 +1,2 @@
+check_for_success("check for success in add_subdirectory")
+do_regex_failure("failing inside of add_subdirectory")

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

Summary of changes:
 Help/release/dev/cached-regex-clear-fixed.rst |    5 +++
 Help/variable/CMAKE_MATCH_COUNT.rst           |    6 +--
 Source/cmMakefile.cxx                         |   10 ++---
 Tests/RegexClear/CMakeLists.txt               |   46 ---------------------
 Tests/RegexClear/RegexClear.c                 |    4 --
 Tests/RegexClear/cmake/Finddummy.cmake        |    4 --
 Tests/RegexClear/subdir/CMakeLists.txt        |    2 -
 Tests/RunCMake/string/RegexClear.cmake        |   54 +++++++++++++++++++++++++
 Tests/RunCMake/string/RunCMakeTest.cmake      |    2 +
 Tests/RunCMake/string/cmake/Finddummy.cmake   |    4 ++
 Tests/RunCMake/string/subdir/CMakeLists.txt   |    2 +
 11 files changed, 75 insertions(+), 64 deletions(-)
 create mode 100644 Help/release/dev/cached-regex-clear-fixed.rst
 delete mode 100644 Tests/RegexClear/CMakeLists.txt
 delete mode 100644 Tests/RegexClear/RegexClear.c
 delete mode 100644 Tests/RegexClear/cmake/Finddummy.cmake
 delete mode 100644 Tests/RegexClear/subdir/CMakeLists.txt
 create mode 100644 Tests/RunCMake/string/RegexClear.cmake
 create mode 100644 Tests/RunCMake/string/cmake/Finddummy.cmake
 create mode 100644 Tests/RunCMake/string/subdir/CMakeLists.txt


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list