diff options
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 28 |
1 files 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<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.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 = ","; } } |