Ninja: use cd /D to set directory on Windows

Add_custom_command was unable to handle build and source directories
existing on different drives.
This commit is contained in:
Ian Monroe 2013-04-18 10:57:39 -07:00 committed by Robert Maynard
parent 6a3ee5dd4e
commit e7c58f6c35
1 changed files with 6 additions and 1 deletions

View File

@ -302,7 +302,12 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines(const cmCustomCommand *cc,
wd = this->GetMakefile()->GetStartOutputDirectory();
cmOStringStream cdCmd;
cdCmd << "cd " << this->ConvertToOutputFormat(wd, SHELL);
#ifdef _WIN32
std::string cdStr = "cd /D ";
#else
std::string cdStr = "cd ";
#endif
cdCmd << cdStr << this->ConvertToOutputFormat(wd, SHELL);
cmdLines.push_back(cdCmd.str());
}
for (unsigned i = 0; i != ccg.GetNumberOfCommands(); ++i) {