From 019dabc97fd8e71c4682a653138069d0a3026558 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 28 Sep 2006 10:37:19 -0400 Subject: [PATCH] BUG: MSYS makefile shell needs posix paths to executables in some cases and it does not hurt to do it always. --- Source/cmGlobalMSYSMakefileGenerator.cxx | 1 + Source/cmLocalGenerator.cxx | 13 +++++++++++++ Source/cmLocalGenerator.h | 1 + Source/cmLocalUnixMakefileGenerator3.h | 7 +++++++ 4 files changed, 22 insertions(+) diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx index 8ae0b086c..9cce56460 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.cxx +++ b/Source/cmGlobalMSYSMakefileGenerator.cxx @@ -88,6 +88,7 @@ cmLocalGenerator *cmGlobalMSYSMakefileGenerator::CreateLocalGenerator() { cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3; lg->SetWindowsShell(false); + lg->SetMSYSShell(true); lg->SetGlobalGenerator(this); lg->SetIgnoreLibPrefix(true); lg->SetPassMakeflags(false); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 95eb666c5..bcd05c380 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -40,6 +40,7 @@ cmLocalGenerator::cmLocalGenerator() this->Parent = 0; this->WindowsShell = false; this->WindowsVSIDE = false; + this->MSYSShell = false; this->IgnoreLibPrefix = false; this->UseRelativePaths = false; this->Configured = false; @@ -2007,6 +2008,18 @@ std::string cmLocalGenerator::Convert(const char* source, { cmSystemTools::SetForceUnixPaths(true); } + + // For the MSYS shell convert drive letters to posix paths, so + // that c:/some/path becomes /c/some/path. This is needed to + // avoid problems with the shell path translation. + if(this->MSYSShell) + { + if(result.size() > 2 && result[1] == ':') + { + result[1] = result[0]; + result[0] = '/'; + } + } } return result; } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 66b47e563..f12ed9c7e 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -274,6 +274,7 @@ protected: bool WindowsShell; bool WindowsVSIDE; bool ForceUnixPath; + bool MSYSShell; bool UseRelativePaths; bool IgnoreLibPrefix; bool Configured; diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 6e0491ecb..31c3e5819 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -107,6 +107,13 @@ public: */ void SetWindowsShell(bool v) {this->WindowsShell = v;} + /** + * Set to true if the shell being used is the MSYS shell. + * This controls if statements in the makefile and the SHELL variable. + * The default is false. + */ + void SetMSYSShell(bool v) {this->MSYSShell = v;} + /** * If set to true, then NULL is set to nil for non Windows_NT. * This uses make syntax used by nmake and borland.