Browse Source

added escape quotes option in replace strings

Ken Martin 24 years ago
parent
commit
43793f7df4
2 changed files with 14 additions and 2 deletions
  1. 13 2
      Source/cmMakefile.cxx
  2. 1 0
      Source/cmMakefile.h

+ 13 - 2
Source/cmMakefile.cxx

@@ -751,20 +751,31 @@ int cmMakefile::DumpDocumentationToFile(const char *fileName)
 
 
 void cmMakefile::ExpandVariablesInString(std::string& source) const
+{
+  this->ExpandVariablesInString(source, false);
+}
+
+void cmMakefile::ExpandVariablesInString(std::string& source, 
+                                         bool escapeQuotes) const
 {
   for(DefinitionMap::const_iterator i = m_Definitions.begin();
       i != m_Definitions.end(); ++i)
     {
+    std::string replace = (*i).second;
+    if (escapeQuotes)
+      {
+      replace = cmSystemTools::EscapeQuotes(replace.c_str());
+      }
     std::string variable = "${";
     variable += (*i).first;
     variable += "}";
     cmSystemTools::ReplaceString(source, variable.c_str(),
-                                 (*i).second.c_str());
+                                 replace.c_str());
     variable = "@";
     variable += (*i).first;
     variable += "@";
     cmSystemTools::ReplaceString(source, variable.c_str(),
-                                 (*i).second.c_str());
+                                 replace.c_str());
     }
 }
 

+ 1 - 0
Source/cmMakefile.h

@@ -451,6 +451,7 @@ public:
    * expanded to match autoconf style expansions.
    */
   void ExpandVariablesInString(std::string& source) const;
+  void ExpandVariablesInString(std::string& source, bool escapeQuotes) const;
 
   /**
    * Remove any remaining variables in the string. Anything with ${var} or