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).

This commit is contained in:
Brad King 2006-04-20 15:28:56 -04:00
parent 31875743e9
commit 350c3efe7b
1 changed files with 23 additions and 9 deletions

View File

@ -864,18 +864,32 @@ cmLocalVisualStudio7Generator
for(std::vector<cmStdString>::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 += "$(OutDir)";
fout << comma << this->ConvertToXMLOutputPath(dir.c_str())
<< "," << this->ConvertToXMLOutputPath(d->c_str());
comma = ",";
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 = rel;
}
}
// 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 = ",";
}
}