From 8824f7984a5b19f3e5496b418f3716ffc6bf4718 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 9 Oct 2006 21:48:48 -0400 Subject: BUG: Fixed references to projects outside the build tree and in other locations with spaces in the path. This is needed for out-of-source/out-of-binary subdirectories in the build. --- Source/cmGlobalVisualStudio71Generator.cxx | 7 +++---- Source/cmGlobalVisualStudio7Generator.cxx | 21 ++++++++++++++++++--- Source/cmGlobalVisualStudio7Generator.h | 1 + 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 0ca3250..d5d4d51 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -294,10 +294,10 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, const char* dir, cmTarget& t) { - std::string d = cmSystemTools::ConvertToOutputPath(dir); fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" << dspname << "\", \"" - << d << "\\" << dspname << ".vcproj\", \"{" + << this->ConvertToSolutionPath(dir) + << "\\" << dspname << ".vcproj\", \"{" << this->GetGUID(dspname) << "}\"\n"; fout << "\tProjectSection(ProjectDependencies) = postProject\n"; this->WriteProjectDepends(fout, dspname, dir, t); @@ -379,10 +379,9 @@ void cmGlobalVisualStudio71Generator const char* location, const std::vector& depends) { - std::string d = cmSystemTools::ConvertToOutputPath(location); fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" << name << "\", \"" - << d << "\", \"{" + << this->ConvertToSolutionPath(location) << "\", \"{" << this->GetGUID(name) << "}\"\n"; diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 22c6647..ec24d22 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -554,6 +554,21 @@ void cmGlobalVisualStudio7Generator this->WriteSLNFooter(fout); } +//---------------------------------------------------------------------------- +std::string +cmGlobalVisualStudio7Generator::ConvertToSolutionPath(const char* path) +{ + // Convert to backslashes. Do not use ConvertToOutputPath because + // we will add quoting ourselves, and we know these projects always + // use windows slashes. + std::string d = path; + std::string::size_type pos = 0; + while((pos = d.find('/', pos)) != d.npos) + { + d[pos++] = '\\'; + } + return d; +} // Write a dsp file into the SLN file, // Note, that dependencies from executables to @@ -562,10 +577,10 @@ void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout, const char* dspname, const char* dir, cmTarget&) { - std::string d = cmSystemTools::ConvertToOutputPath(dir); fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" << dspname << "\", \"" - << d << "\\" << dspname << ".vcproj\", \"{" + << this->ConvertToSolutionPath(dir) + << "\\" << dspname << ".vcproj\", \"{" << this->GetGUID(dspname) << "}\"\nEndProject\n"; } @@ -681,7 +696,7 @@ void cmGlobalVisualStudio7Generator::WriteExternalProject(std::ostream& fout, std::string d = cmSystemTools::ConvertToOutputPath(location); fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" << name << "\", \"" - << d << "\", \"{" + << this->ConvertToSolutionPath(location) << "\", \"{" << this->GetGUID(name) << "}\"\n"; fout << "EndProject\n"; diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index c8902cf..e46480b 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -118,6 +118,7 @@ protected: const char* name, const char* path, const std::vector& dependencies); + std::string ConvertToSolutionPath(const char* path); std::vector Configurations; std::map GUIDMap; -- cgit v0.12