diff options
author | Brad King <brad.king@kitware.com> | 2008-01-23 18:03:03 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2008-01-23 18:03:03 (GMT) |
commit | 865c2bc6d657fc79df96b74ca9d1b1eb26f0bbc6 (patch) | |
tree | a0f60ff0cb79380bb33488e501b58478bd2784af | |
parent | 3d63c85f75209d605273c03227c4e0bc7f5d0303 (diff) | |
download | CMake-865c2bc6d657fc79df96b74ca9d1b1eb26f0bbc6.zip CMake-865c2bc6d657fc79df96b74ca9d1b1eb26f0bbc6.tar.gz CMake-865c2bc6d657fc79df96b74ca9d1b1eb26f0bbc6.tar.bz2 |
BUG: Work-around bug in MSVC 6 command line parsing.
-rw-r--r-- | Source/cmLocalGenerator.cxx | 35 | ||||
-rw-r--r-- | Source/cmLocalGenerator.h | 2 |
2 files changed, 36 insertions, 1 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 60a6b72..62245fe 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1451,6 +1451,39 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, } } +std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + // Work-ardound MSVC 6 command line bug. This block is only needed + // on windows when we are really using the MSVC 6.0 compiler command + // line. + if(this->Makefile->IsOn("MSVC60")) + { + // Search for the last space. + std::string::size_type pos = lib.rfind(' '); + if(pos != lib.npos) + { + // Find the slash after the last space, if any. + pos = lib.find('/', pos); + + // Convert the portion of the path with a space to a short path. + std::string sp; + if(cmSystemTools::GetShortPath(lib.substr(0, pos).c_str(), sp)) + { + // Append the rest of the path with no space. + sp += lib.substr(pos); + + // Convert to an output path. + return this->Convert(sp.c_str(), NONE, SHELL); + } + } + } +#endif + + // Normal behavior. + return this->Convert(lib.c_str(), START_OUTPUT, SHELL); +} + bool cmLocalGenerator::GetLinkerArgs(std::string& rpath, std::string& linkLibs, cmTarget& tgt, @@ -1554,7 +1587,7 @@ bool cmLocalGenerator::GetLinkerArgs(std::string& rpath, { if(li->IsPath) { - linkLibs += this->Convert(li->Value.c_str(), START_OUTPUT, SHELL); + linkLibs += this->ConvertToLinkReference(li->Value); } else { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 9a9be8c..f334163 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -327,6 +327,8 @@ protected: std::string FindRelativePathTopBinary(); void SetupPathConversions(); + std::string ConvertToLinkReference(std::string const& lib); + /** Check whether the native build system supports the given definition. Issues a warning. */ virtual bool CheckDefinition(std::string const& define) const; |