From 350c3efe7bde6d1cd3e24a309f8c1d9671699a16 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 20 Apr 2006 15:28:56 -0400 Subject: BUG: VS7 seems to have a limit on the length of the link directory list string. Try to make the string as short as possible by avoiding trailing slashes and using a relative path (if it is shorter). --- Source/cmLocalVisualStudio7Generator.cxx | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 1f40847..03bc74b 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -864,18 +864,32 @@ cmLocalVisualStudio7Generator for(std::vector::const_iterator d = dirs.begin(); d != dirs.end(); ++d) { + // Remove any trailing slash and skip empty paths. std::string dir = *d; - if(!dir.empty()) + if(dir[dir.size()-1] == '/') { - if(dir[dir.size()-1] != '/') + dir = dir.substr(0, dir.size()-1); + } + if(dir.empty()) + { + continue; + } + + // Switch to a relative path specification if it is shorter. + if(cmSystemTools::FileIsFullPath(dir.c_str())) + { + std::string rel = this->Convert(dir.c_str(), START_OUTPUT, UNCHANGED); + if(rel.size() < dir.size()) { - dir += "/"; + dir = rel; } - dir += "$(OutDir)"; - fout << comma << this->ConvertToXMLOutputPath(dir.c_str()) - << "," << this->ConvertToXMLOutputPath(d->c_str()); - comma = ","; } + + // First search a configuration-specific subdirectory and then the + // original directory. + fout << comma << this->ConvertToXMLOutputPath((dir+"/$(OutDir)").c_str()) + << "," << this->ConvertToXMLOutputPath(dir.c_str()); + comma = ","; } } -- cgit v0.12