Browse Source

cmCacheManager: parse -D flags more strictly

In the case of:

    -DCACHE_VARS=-DEXTERNAL_PROJECT_CMAKE_ARG:BOOL=TRUE

the variable is parsed out as:

    CACHE_VARS=-DEXTERNAL_PROJECT_CMAKE_ARG

because the parser allows '=' in the variable name. Disallow such a name
on the command line.
Ben Boeckel 11 years ago
parent
commit
aee7e4a03b
2 changed files with 2 additions and 2 deletions
  1. 1 1
      Source/cmCacheManager.cxx
  2. 1 1
      Tests/RunCMake/CommandLine/D_nested_cache-stderr.txt

+ 1 - 1
Source/cmCacheManager.cxx

@@ -139,7 +139,7 @@ bool cmCacheManager::ParseEntry(const std::string& entry,
 {
   // input line is:         key:type=value
   static cmsys::RegularExpression reg(
-    "^([^:]*):([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$");
+    "^([^=:]*):([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$");
   // input line is:         "key":type=value
   static cmsys::RegularExpression regQuoted(
     "^\"([^\"]*)\":([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$");

+ 1 - 1
Tests/RunCMake/CommandLine/D_nested_cache-stderr.txt

@@ -1 +1 @@
-^--><--$
+^-->-DBAR:BOOL=BAZ<--$