added escape quotes option in replace strings

This commit is contained in:
Ken Martin 2001-06-22 11:14:32 -04:00
parent b977136904
commit 43793f7df4
2 changed files with 14 additions and 2 deletions

View File

@ -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());
}
}

View File

@ -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