summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalNinjaGenerator.cxx
diff options
context:
space:
mode:
authorPeter Kuemmel <syntheticpp@gmx.net>2012-02-18 07:07:11 (GMT)
committerPeter Kuemmel <syntheticpp@gmx.net>2012-02-18 07:15:23 (GMT)
commit7fb2bb3e8b0dc7bc718aadc4ab9a74cb7fdb656e (patch)
treed96a23ef8d6a46a7e291a596875d5d9452a78ab5 /Source/cmGlobalNinjaGenerator.cxx
parent5d19e8aa6aac75fb08897aece8aa5545360aeeb2 (diff)
downloadCMake-7fb2bb3e8b0dc7bc718aadc4ab9a74cb7fdb656e.zip
CMake-7fb2bb3e8b0dc7bc718aadc4ab9a74cb7fdb656e.tar.gz
CMake-7fb2bb3e8b0dc7bc718aadc4ab9a74cb7fdb656e.tar.bz2
Ninja: win fixes: escape back slash/colon, use cd. as cmd.exe nop
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,