[cmake-commits] alex committed cmCacheManager.cxx 1.96 1.97 cmake.cxx 1.292 1.293 cmake.h 1.78 1.79

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Jun 4 13:48:13 EDT 2007


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv29844/Source

Modified Files:
	cmCacheManager.cxx cmake.cxx cmake.h 
Log Message:

ENH: -U for removing variables now uses globbing expressions
-cmCacheManager: now also variables with type UNINITIALIZED are saved in
CMakeCache.txt, these are the vars defined using -DFOO=foo but without type

Alex


Index: cmake.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmake.h,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- cmake.h	1 Jun 2007 18:16:46 -0000	1.78
+++ cmake.h	4 Jun 2007 17:48:11 -0000	1.79
@@ -388,11 +388,11 @@
    "for the project.  This option may be used to specify a setting " \
    "that takes priority over the project's default value.  The option " \
    "may be repeated for as many cache entries as desired."}, \
-  {"-U <var>", "Remove one or more cmake cache entries.", \
+  {"-U <globbing_expr>", "Remove matching entries from CMake cache.", \
    "This option may be used to remove one or more variables from the " \
-   "CMakeCache.txt file, so that CMake will search them again. All " \
-   "variables which contain \"<var>\" will be removed. The option may be "\
-   "repeated for as many cache entries as desired."}, \
+   "CMakeCache.txt file, globbing expressions using * and ? are supported. "\
+   "The option may be repeated for as many cache entries as desired.\n" \
+   "Use with care, you can make your CMakeCache.txt non-working."}, \
   {"-G <generator-name>", "Specify a makefile generator.", \
    "CMake may support multiple native build systems on certain platforms.  " \
    "A makefile generator is responsible for generating a particular build " \

Index: cmCacheManager.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCacheManager.cxx,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- cmCacheManager.cxx	1 Jun 2007 15:06:48 -0000	1.96
+++ cmCacheManager.cxx	4 Jun 2007 17:48:11 -0000	1.97
@@ -439,7 +439,7 @@
     {
     const CacheEntry& ce = (*i).second; 
     CacheEntryType t = ce.Type;
-    if(t == cmCacheManager::UNINITIALIZED || !ce.Initialized)
+    if(!ce.Initialized)
       {
       /*
         // This should be added in, but is not for now.

Index: cmake.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmake.cxx,v
retrieving revision 1.292
retrieving revision 1.293
diff -u -d -r1.292 -r1.293
--- cmake.cxx	1 Jun 2007 18:16:46 -0000	1.292
+++ cmake.cxx	4 Jun 2007 17:48:11 -0000	1.293
@@ -33,8 +33,10 @@
 # include <cmsys/Terminal.h>
 #endif
 
-# include <cmsys/Directory.hxx>
+#include <cmsys/Directory.hxx>
 #include <cmsys/Process.h>
+#include <cmsys/Glob.hxx>
+#include <cmsys/RegularExpression.hxx>
 
 // only build kdevelop generator on non-windows platforms
 // when not bootstrapping cmake
@@ -288,7 +290,7 @@
           }
         else
           {
-          cmSystemTools::Error("-D must be followed with VAR=VALUE.");
+          cmSystemTools::Error("-D  must be followed with VAR=VALUE.");
           return false;
           }
         }
@@ -298,8 +300,7 @@
         cmCacheManager::ParseEntry(entry.c_str(), var, value))
         {
         this->CacheManager->AddCacheEntry(var.c_str(), value.c_str(),
-          "No help, variable specified on the command line.",
-          type==cmCacheManager::UNINITIALIZED?cmCacheManager::STRING:type);
+          "No help, variable specified on the command line.", type);
         }
       else
         {
@@ -325,7 +326,8 @@
           return false;
           }
         }
-
+      cmsys::RegularExpression regex(
+              cmsys::Glob::PatternToRegex(entryPattern.c_str(), true).c_str());
       //go through all cache entries and collect the vars which will be removed
       std::vector<std::string> entriesToDelete;
       cmCacheManager::CacheIterator it = 
@@ -336,7 +338,7 @@
         if(t != cmCacheManager::STATIC &&  t != cmCacheManager::UNINITIALIZED)
           {
           std::string entryName = it.GetName();
-          if (entryName.find(entryPattern) != std::string::npos)
+          if (regex.find(entryName.c_str()))
             {
             entriesToDelete.push_back(entryName);
             }



More information about the Cmake-commits mailing list