diff options
author | Brad King <brad.king@kitware.com> | 2011-04-08 13:28:59 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2011-04-08 19:36:55 (GMT) |
commit | b5676134ce25df1a60724478d056a95bca106e8f (patch) | |
tree | 90bd4e1ea14d971e0c9a901dbfa176248f957430 /Source/cmLocalUnixMakefileGenerator3.cxx | |
parent | a961ecdad0ec31bacb3f6abff83aa65f0b51a676 (diff) | |
download | CMake-b5676134ce25df1a60724478d056a95bca106e8f.zip CMake-b5676134ce25df1a60724478d056a95bca106e8f.tar.gz CMake-b5676134ce25df1a60724478d056a95bca106e8f.tar.bz2 |
Fix working drive of make rules on Windows
Teach cmLocalUnixMakefileGenerator3::CreateCDCommand to change working
directories for make tools using a Windows shell using "cd /d" instead
of just "cd". This tells the shell to change the current drive letter
as well as the working directory on that drive.
Commit abaa0267 (When the working directory for a custom command is on
another drive..., 2007-12-17) fixed the same problem for VS IDE
generators as reported by issue #6150.
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator3.cxx')
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index d1214d2..d42c124 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2228,17 +2228,20 @@ void cmLocalUnixMakefileGenerator3 return; } + // In a Windows shell we must change drive letter too. + const char* cd_cmd = this->WindowsShell? "cd /d " : "cd "; + if(!this->UnixCD) { // On Windows we must perform each step separately and then change // back because the shell keeps the working directory between // commands. - std::string cmd = "cd "; + std::string cmd = cd_cmd; cmd += this->ConvertToOutputForExisting(tgtDir, relRetDir); commands.insert(commands.begin(),cmd); // Change back to the starting directory. - cmd = "cd "; + cmd = cd_cmd; cmd += this->ConvertToOutputForExisting(relRetDir, tgtDir); commands.push_back(cmd); } @@ -2250,7 +2253,7 @@ void cmLocalUnixMakefileGenerator3 std::vector<std::string>::iterator i = commands.begin(); for (; i != commands.end(); ++i) { - std::string cmd = "cd "; + std::string cmd = cd_cmd; cmd += this->ConvertToOutputForExisting(tgtDir, relRetDir); cmd += " && "; cmd += *i; |