added escape quotes option in replace strings
This commit is contained in:
parent
b977136904
commit
43793f7df4
|
@ -751,20 +751,31 @@ int cmMakefile::DumpDocumentationToFile(const char *fileName)
|
||||||
|
|
||||||
|
|
||||||
void cmMakefile::ExpandVariablesInString(std::string& source) const
|
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();
|
for(DefinitionMap::const_iterator i = m_Definitions.begin();
|
||||||
i != m_Definitions.end(); ++i)
|
i != m_Definitions.end(); ++i)
|
||||||
{
|
{
|
||||||
|
std::string replace = (*i).second;
|
||||||
|
if (escapeQuotes)
|
||||||
|
{
|
||||||
|
replace = cmSystemTools::EscapeQuotes(replace.c_str());
|
||||||
|
}
|
||||||
std::string variable = "${";
|
std::string variable = "${";
|
||||||
variable += (*i).first;
|
variable += (*i).first;
|
||||||
variable += "}";
|
variable += "}";
|
||||||
cmSystemTools::ReplaceString(source, variable.c_str(),
|
cmSystemTools::ReplaceString(source, variable.c_str(),
|
||||||
(*i).second.c_str());
|
replace.c_str());
|
||||||
variable = "@";
|
variable = "@";
|
||||||
variable += (*i).first;
|
variable += (*i).first;
|
||||||
variable += "@";
|
variable += "@";
|
||||||
cmSystemTools::ReplaceString(source, variable.c_str(),
|
cmSystemTools::ReplaceString(source, variable.c_str(),
|
||||||
(*i).second.c_str());
|
replace.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -451,6 +451,7 @@ public:
|
||||||
* expanded to match autoconf style expansions.
|
* expanded to match autoconf style expansions.
|
||||||
*/
|
*/
|
||||||
void ExpandVariablesInString(std::string& source) const;
|
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
|
* Remove any remaining variables in the string. Anything with ${var} or
|
||||||
|
|
Loading…
Reference in New Issue