[Cmake-commits] CMake branch, next, updated. v2.8.3-685-g9bfecdb

Ben Boeckel ben.boeckel at kitware.com
Mon Nov 22 15:48:14 EST 2010


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  9bfecdb01af5ad8338f1a5dc0031dfccb53b614d (commit)
       via  8b143fab66a2d1e93bf01eb7837a33e52644c396 (commit)
       via  122ebf12976ce370d78aa14594baf39f30b5c9ee (commit)
       via  90abc3a027ba68e3866e7cd0e2f8eebd528b6ccb (commit)
       via  6fe8624b7ff39f8511f4f4d7ebcbc5681932a6a5 (commit)
      from  e96366a6950e942e8b10d9875ce96e7d555d97ea (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=9bfecdb01af5ad8338f1a5dc0031dfccb53b614d
commit 9bfecdb01af5ad8338f1a5dc0031dfccb53b614d
Merge: e96366a 8b143fa
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Mon Nov 22 15:48:12 2010 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Nov 22 15:48:12 2010 -0500

    Merge topic 'dev/fix-cache-variable-parsing-ambiguity' into next
    
    8b143fa Condense parsing of cache entries
    122ebf1 Support manual cache entries
    90abc3a Use cmCacheManager to load entries from the cache
    6fe8624 Fix parsing of cache variables without a type


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8b143fab66a2d1e93bf01eb7837a33e52644c396
commit 8b143fab66a2d1e93bf01eb7837a33e52644c396
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Mon Nov 22 15:45:30 2010 -0500
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Mon Nov 22 15:45:30 2010 -0500

    Condense parsing of cache entries
    
    If a cache line is being parsed, it shouldn't matter whether it has a
    type or not; just parse it however possible.

diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index eabdf87..2baacbf 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -93,9 +93,9 @@ bool cmCacheManager::LoadCache(const char* path,
   return this->LoadCache(path, internal, emptySet, emptySet);
 }
 
-bool cmCacheManager::ParseEntry(const char* entry,
-                                std::string& var,
-                                std::string& value)
+static bool ParseEntryWithoutType(const char* entry,
+                                  std::string& var,
+                                  std::string& value)
 {
   // input line is:         key=value
   static cmsys::RegularExpression reg(
@@ -169,6 +169,11 @@ bool cmCacheManager::ParseEntry(const char* entry,
                          value.size() - 2);
     }
 
+  if (!flag)
+    {
+    return ParseEntryWithoutType(entry, var, value);
+    }
+
   return flag;
 }
 
@@ -253,8 +258,7 @@ bool cmCacheManager::LoadCache(const char* path,
         }
       }
     e.SetProperty("HELPSTRING", helpString.c_str());
-    if(cmCacheManager::ParseEntry(realbuffer, entryKey, e.Value, e.Type) ||
-      cmCacheManager::ParseEntry(realbuffer, entryKey, e.Value))
+    if(cmCacheManager::ParseEntry(realbuffer, entryKey, e.Value, e.Type))
       {
       if ( excludes.find(entryKey) == excludes.end() )
         {
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index da14966..314017b 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -139,10 +139,6 @@ public:
                          std::string& value,
                          CacheEntryType& type);
 
-  static bool ParseEntry(const char* entry, 
-                         std::string& var,
-                         std::string& value);
-
   ///! Get a value from the cache given a key
   const char* GetCacheValue(const char* key) const;
 
diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx
index b06e2f9..a239e55 100644
--- a/Source/cmLoadCacheCommand.cxx
+++ b/Source/cmLoadCacheCommand.cxx
@@ -175,8 +175,7 @@ void cmLoadCacheCommand::CheckLine(const char* line)
   std::string var;
   std::string value;
   cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED;
-  if(cmCacheManager::ParseEntry(line, var, value, type) ||
-    cmCacheManager::ParseEntry(line, var, value))
+  if(cmCacheManager::ParseEntry(line, var, value, type))
     {
     // Found a real entry.  See if this one was requested.
     if(this->VariablesToRead.find(var) != this->VariablesToRead.end())
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 2ebd165..e332955 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -362,8 +362,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
         }
       std::string var, value;
       cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED;
-      if(cmCacheManager::ParseEntry(entry.c_str(), var, value, type) ||
-        cmCacheManager::ParseEntry(entry.c_str(), var, value))
+      if(cmCacheManager::ParseEntry(entry.c_str(), var, value, type))
         {
         this->CacheManager->AddCacheEntry(var.c_str(), value.c_str(),
           "No help, variable specified on the command line.", type);

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=122ebf12976ce370d78aa14594baf39f30b5c9ee
commit 122ebf12976ce370d78aa14594baf39f30b5c9ee
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Mon Nov 22 15:17:51 2010 -0500
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Mon Nov 22 15:17:51 2010 -0500

    Support manual cache entries

diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index fe6467a..eabdf87 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -253,7 +253,8 @@ bool cmCacheManager::LoadCache(const char* path,
         }
       }
     e.SetProperty("HELPSTRING", helpString.c_str());
-    if(cmCacheManager::ParseEntry(realbuffer, entryKey, e.Value, e.Type))
+    if(cmCacheManager::ParseEntry(realbuffer, entryKey, e.Value, e.Type) ||
+      cmCacheManager::ParseEntry(realbuffer, entryKey, e.Value))
       {
       if ( excludes.find(entryKey) == excludes.end() )
         {

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=90abc3a027ba68e3866e7cd0e2f8eebd528b6ccb
commit 90abc3a027ba68e3866e7cd0e2f8eebd528b6ccb
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Mon Nov 22 15:14:21 2010 -0500
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Mon Nov 22 15:14:21 2010 -0500

    Use cmCacheManager to load entries from the cache

diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx
index d2a07dc..b06e2f9 100644
--- a/Source/cmLoadCacheCommand.cxx
+++ b/Source/cmLoadCacheCommand.cxx
@@ -174,7 +174,9 @@ void cmLoadCacheCommand::CheckLine(const char* line)
   // Check one line of the cache file.
   std::string var;
   std::string value;
-  if(this->ParseEntry(line, var, value))
+  cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED;
+  if(cmCacheManager::ParseEntry(line, var, value, type) ||
+    cmCacheManager::ParseEntry(line, var, value))
     {
     // Found a real entry.  See if this one was requested.
     if(this->VariablesToRead.find(var) != this->VariablesToRead.end())
@@ -193,38 +195,3 @@ void cmLoadCacheCommand::CheckLine(const char* line)
       }
     }
 }
-
-//----------------------------------------------------------------------------
-bool cmLoadCacheCommand::ParseEntry(const char* entry, std::string& var,
-                                    std::string& value)
-{
-  // input line is:         key:type=value
-  cmsys::RegularExpression reg("^([^:]*):([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$");
-  // input line is:         "key":type=value
-  cmsys::RegularExpression 
-    regQuoted("^\"([^\"]*)\":([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$");
-  bool flag = false;
-  if(regQuoted.find(entry))
-    {
-    var = regQuoted.match(1);
-    value = regQuoted.match(3);
-    flag = true;
-    }
-  else if (reg.find(entry))
-    {
-    var = reg.match(1);
-    value = reg.match(3);
-    flag = true;
-    }
-
-  // if value is enclosed in single quotes ('foo') then remove them
-  // it is used to enclose trailing space or tab
-  if (flag && 
-      value.size() >= 2 &&
-      value[0] == '\'' && 
-      value[value.size() - 1] == '\'') 
-    {
-    value = value.substr(1, value.size() - 2);
-    }
-  return flag;
-}
diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h
index b06d94d..8ecee4a 100644
--- a/Source/cmLoadCacheCommand.h
+++ b/Source/cmLoadCacheCommand.h
@@ -83,7 +83,6 @@ protected:
   
   bool ReadWithPrefix(std::vector<std::string> const& args);
   void CheckLine(const char* line);
-  bool ParseEntry(const char* entry, std::string& var, std::string& value);
 };
 
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6fe8624b7ff39f8511f4f4d7ebcbc5681932a6a5
commit 6fe8624b7ff39f8511f4f4d7ebcbc5681932a6a5
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Mon Nov 22 14:56:55 2010 -0500
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Mon Nov 22 15:12:47 2010 -0500

    Fix parsing of cache variables without a type
    
    These mainly come from the command line or manual entries in the
    CMakeCache.txt file. We want to stop at the first '=' because this is
    what is most likely to have been meant. The variable can be quoted if
    the '=' is intended.
    
    Caveat: What if one wants both '"' and '=' in a variable name?

diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 2aa6236..fe6467a 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -97,10 +97,10 @@ bool cmCacheManager::ParseEntry(const char* entry,
                                 std::string& var,
                                 std::string& value)
 {
-  // input line is:         key:type=value
+  // input line is:         key=value
   static cmsys::RegularExpression reg(
-    "^([^:]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$");
-  // input line is:         "key":type=value
+    "^([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$");
+  // input line is:         "key"=value
   static cmsys::RegularExpression regQuoted(
     "^\"([^\"]*)\"=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$");
   bool flag = false;

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

Summary of changes:
 Source/cmCacheManager.cxx     |   17 +++++++++++------
 Source/cmCacheManager.h       |    4 ----
 Source/cmLoadCacheCommand.cxx |   38 ++------------------------------------
 Source/cmLoadCacheCommand.h   |    1 -
 Source/cmake.cxx              |    3 +--
 5 files changed, 14 insertions(+), 49 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list