Browse Source

ENH: When fixing cache value with uninitialized type, collapse full paths for PATH and FILEPATH. Closes Bug #82 - Specifying relative path when entering path can break things

Andy Cedilnik 22 years ago
parent
commit
a6567329d7
1 changed files with 20 additions and 0 deletions
  1. 20 0
      Source/cmMakefile.cxx

+ 20 - 0
Source/cmMakefile.cxx

@@ -846,6 +846,26 @@ void cmMakefile::AddCacheDefinition(const char* name, const char* value,
     it.Initialized())
     {
     val = it.GetValue();
+    if ( type == cmCacheManager::PATH || type == cmCacheManager::FILEPATH )
+      {
+      std::vector<std::string>::size_type cc;
+      std::vector<std::string> files;
+      std::string nvalue = "";
+      cmSystemTools::ExpandListArgument(val, files);
+      for ( cc = 0; cc < files.size(); cc ++ )
+        {
+        files[cc] = cmSystemTools::CollapseFullPath(files[cc].c_str());
+        if ( cc > 0 )
+          {
+          nvalue += ";";
+          }
+        nvalue += files[cc];
+        }
+
+      this->GetCacheManager()->AddCacheEntry(name, nvalue.c_str(), doc, type);
+      val = it.GetValue();
+      }
+
     }
   this->GetCacheManager()->AddCacheEntry(name, val, doc, type);
   this->AddDefinition(name, val);