summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalNinjaGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmGlobalNinjaGenerator.cxx')
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 7ff33ba..879a973 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -59,6 +59,7 @@ static bool IsIdentChar(char c)
(c == '_') || (c == '$') || (c == '\\');
}
+
std::string cmGlobalNinjaGenerator::EncodeIdent(const std::string &ident,
std::ostream &vars) {
if (std::find_if(ident.begin(), ident.end(),
@@ -69,14 +70,19 @@ std::string cmGlobalNinjaGenerator::EncodeIdent(const std::string &ident,
vars << names.str() << " = " << ident << "\n";
return "$" + names.str();
} else {
- return ident;
+ return EncodeLiteral(ident);
}
}
+
std::string cmGlobalNinjaGenerator::EncodeLiteral(const std::string &lit)
{
std::string result = lit;
cmSystemTools::ReplaceString(result, "$", "$$");
+ cmSystemTools::ReplaceString(result, ":", "$:");
+#ifdef _WIN32
+ cmSystemTools::ReplaceString(result, "/", "\\");
+#endif
return result;
}
@@ -200,7 +206,8 @@ cmGlobalNinjaGenerator::WriteCustomCommandBuild(const std::string& command,
this->AddCustomCommandRule();
cmNinjaVars vars;
- vars["COMMAND"] = command;
+
+ vars["COMMAND"] = EncodeLiteral(command);
vars["DESC"] = EncodeLiteral(description);
cmGlobalNinjaGenerator::WriteBuild(*this->BuildFileStream,