Ninja: Shell encode various CMake invocations

This commit is contained in:
Peter Collingbourne 2012-02-19 03:07:09 +00:00
parent 43b1d8bad0
commit 0643fee2fe
2 changed files with 17 additions and 6 deletions

View File

@ -743,12 +743,19 @@ void cmGlobalNinjaGenerator::WriteTargetAll(std::ostream& os)
void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os) void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
{ {
cmMakefile* mfRoot = this->LocalGenerators[0]->GetMakefile(); cmLocalGenerator *lg = this->LocalGenerators[0];
cmMakefile* mfRoot = lg->GetMakefile();
std::ostringstream cmd; std::ostringstream cmd;
cmd << mfRoot->GetRequiredDefinition("CMAKE_COMMAND") cmd << lg->ConvertToOutputFormat(
<< " -H" << mfRoot->GetHomeDirectory() mfRoot->GetRequiredDefinition("CMAKE_COMMAND"),
<< " -B" << mfRoot->GetHomeOutputDirectory(); cmLocalGenerator::SHELL)
<< " -H"
<< lg->ConvertToOutputFormat(mfRoot->GetHomeDirectory(),
cmLocalGenerator::SHELL)
<< " -B"
<< lg->ConvertToOutputFormat(mfRoot->GetHomeOutputDirectory(),
cmLocalGenerator::SHELL);
WriteRule(*this->RulesFileStream, WriteRule(*this->RulesFileStream,
"RERUN_CMAKE", "RERUN_CMAKE",
cmd.str(), cmd.str(),

View File

@ -198,7 +198,9 @@ cmNinjaNormalTargetGenerator
if (this->TargetNameOut != this->TargetNameReal) { if (this->TargetNameOut != this->TargetNameReal) {
std::string cmakeCommand = std::string cmakeCommand =
this->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND"); this->GetLocalGenerator()->ConvertToOutputFormat(
this->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND"),
cmLocalGenerator::SHELL);
if (targetType == cmTarget::EXECUTABLE) if (targetType == cmTarget::EXECUTABLE)
this->GetGlobalGenerator()->AddRule("CMAKE_SYMLINK_EXECUTABLE", this->GetGlobalGenerator()->AddRule("CMAKE_SYMLINK_EXECUTABLE",
cmakeCommand + cmakeCommand +
@ -238,7 +240,9 @@ cmNinjaNormalTargetGenerator
// We have archive link commands set. First, delete the existing archive. // We have archive link commands set. First, delete the existing archive.
std::vector<std::string> linkCmds; std::vector<std::string> linkCmds;
std::string cmakeCommand = std::string cmakeCommand =
this->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND"); this->GetLocalGenerator()->ConvertToOutputFormat(
this->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND"),
cmLocalGenerator::SHELL);
linkCmds.push_back(cmakeCommand + " -E remove $out"); linkCmds.push_back(cmakeCommand + " -E remove $out");
// TODO: Use ARCHIVE_APPEND for archives over a certain size. // TODO: Use ARCHIVE_APPEND for archives over a certain size.