Ninja: Partially revert "win fixes: escape back slash/colon, use cd. as cmd.exe nop"

It introduced encoding rules in the wrong place, and broke the
CustomCommand test case.

This reverts commit 7fb2bb3e8b.
This commit is contained in:
Peter Collingbourne 2012-02-18 16:32:47 +00:00
parent f999a59afe
commit 99856d537c
2 changed files with 7 additions and 13 deletions

View File

@ -353,8 +353,9 @@ IF (WIN32)
ENDIF(NOT UNIX)
ENDIF (WIN32)
SET(SRCS ${SRCS}
# Ninja only works on UNIX.
IF(UNIX)
SET(SRCS ${SRCS}
cmGlobalNinjaGenerator.cxx
cmGlobalNinjaGenerator.h
cmNinjaTypes.h
@ -367,8 +368,8 @@ SET(SRCS ${SRCS}
cmNinjaUtilityTargetGenerator.cxx
cmNinjaUtilityTargetGenerator.h
)
ADD_DEFINITIONS(-DCMAKE_USE_NINJA)
ADD_DEFINITIONS(-DCMAKE_USE_NINJA)
ENDIF(UNIX)
# create a library used by the command line and the GUI
ADD_LIBRARY(CMakeLib ${SRCS})

View File

@ -59,7 +59,6 @@ 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(),
@ -70,19 +69,14 @@ std::string cmGlobalNinjaGenerator::EncodeIdent(const std::string &ident,
vars << names.str() << " = " << ident << "\n";
return "$" + names.str();
} else {
return EncodeLiteral(ident);
return 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;
}
@ -206,8 +200,7 @@ cmGlobalNinjaGenerator::WriteCustomCommandBuild(const std::string& command,
this->AddCustomCommandRule();
cmNinjaVars vars;
vars["COMMAND"] = EncodeLiteral(command);
vars["COMMAND"] = command;
vars["DESC"] = EncodeLiteral(description);
cmGlobalNinjaGenerator::WriteBuild(*this->BuildFileStream,