ENH: only output each link path once

This commit is contained in:
Bill Hoffman 2002-01-17 12:54:56 -05:00
parent 4688198996
commit 3df3d839cc
1 changed files with 56 additions and 37 deletions

View File

@ -550,6 +550,8 @@ void cmDSPWriter::WriteDSPHeader(std::ostream& fout, const char *libName,
const cmTarget &target, const cmTarget &target,
std::vector<cmSourceGroup> &) std::vector<cmSourceGroup> &)
{ {
std::set<std::string> pathEmitted;
// determine the link directories // determine the link directories
std::string libOptions; std::string libOptions;
std::string libDebugOptions; std::string libDebugOptions;
@ -578,19 +580,23 @@ void cmDSPWriter::WriteDSPHeader(std::ostream& fout, const char *libName,
{ {
libPath += "/"; libPath += "/";
} }
std::string lpath = cmSystemTools::HandleNetworkPaths(libPath.c_str());
if(pathEmitted.insert(lpath).second)
{
libOptions += " /LIBPATH:\""; libOptions += " /LIBPATH:\"";
libOptions += cmSystemTools::HandleNetworkPaths(libPath.c_str()); libOptions += lpath;
libOptions += "$(INTDIR)\" "; libOptions += "$(INTDIR)\" ";
libOptions += " /LIBPATH:\""; libOptions += " /LIBPATH:\"";
libOptions += cmSystemTools::HandleNetworkPaths(libPath.c_str()); libOptions += lpath;
libOptions += "\" "; libOptions += "\" ";
libMultiLineOptions += "# ADD LINK32 /LIBPATH:\""; libMultiLineOptions += "# ADD LINK32 /LIBPATH:\"";
libMultiLineOptions += cmSystemTools::HandleNetworkPaths(libPath.c_str()); libMultiLineOptions += lpath;
libMultiLineOptions += "$(INTDIR)\" "; libMultiLineOptions += "$(INTDIR)\" ";
libMultiLineOptions += " /LIBPATH:\""; libMultiLineOptions += " /LIBPATH:\"";
libMultiLineOptions += cmSystemTools::HandleNetworkPaths(libPath.c_str()); libMultiLineOptions += lpath;
libMultiLineOptions += "\" \n"; libMultiLineOptions += "\" \n";
} }
}
if(exePath.size()) if(exePath.size())
{ {
// make sure there is a trailing slash // make sure there is a trailing slash
@ -598,37 +604,50 @@ void cmDSPWriter::WriteDSPHeader(std::ostream& fout, const char *libName,
{ {
exePath += "/"; exePath += "/";
} }
std::string lpath = cmSystemTools::HandleNetworkPaths(exePath.c_str());
if(pathEmitted.insert(lpath).second)
{
libOptions += " /LIBPATH:\""; libOptions += " /LIBPATH:\"";
libOptions += cmSystemTools::HandleNetworkPaths(exePath.c_str()); libOptions += lpath;
libOptions += "$(INTDIR)\" "; libOptions += "$(INTDIR)\" ";
libOptions += " /LIBPATH:\""; libOptions += " /LIBPATH:\"";
libOptions += cmSystemTools::HandleNetworkPaths(exePath.c_str()); libOptions += lpath;
libOptions += "\" "; libOptions += "\" ";
libMultiLineOptions += "# ADD LINK32 /LIBPATH:\""; libMultiLineOptions += "# ADD LINK32 /LIBPATH:\"";
libMultiLineOptions += cmSystemTools::HandleNetworkPaths(exePath.c_str()); libMultiLineOptions += lpath;
libMultiLineOptions += "$(INTDIR)\" "; libMultiLineOptions += "$(INTDIR)\" ";
libMultiLineOptions += " /LIBPATH:\""; libMultiLineOptions += " /LIBPATH:\"";
libMultiLineOptions += cmSystemTools::HandleNetworkPaths(exePath.c_str()); libMultiLineOptions += lpath;
libMultiLineOptions += "\" \n"; libMultiLineOptions += "\" \n";
} }
}
std::vector<std::string>::iterator i; std::vector<std::string>::iterator i;
std::vector<std::string>& libdirs = m_Makefile->GetLinkDirectories(); std::vector<std::string>& libdirs = m_Makefile->GetLinkDirectories();
for(i = libdirs.begin(); i != libdirs.end(); ++i) for(i = libdirs.begin(); i != libdirs.end(); ++i)
{
std::string lpath = cmSystemTools::HandleNetworkPaths(i->c_str());
if(lpath[lpath.size()-1] != '/')
{
lpath += "/";
}
if(pathEmitted.insert(lpath).second)
{ {
libOptions += " /LIBPATH:\""; libOptions += " /LIBPATH:\"";
libOptions += cmSystemTools::HandleNetworkPaths(i->c_str()); libOptions += lpath;
libOptions += "/$(INTDIR)\" "; libOptions += "/$(INTDIR)\" ";
libOptions += " /LIBPATH:\""; libOptions += " /LIBPATH:\"";
libOptions += cmSystemTools::HandleNetworkPaths(i->c_str()); libOptions += lpath;
libOptions += "\" "; libOptions += "\" ";
libMultiLineOptions += "# ADD LINK32 /LIBPATH:\""; libMultiLineOptions += "# ADD LINK32 /LIBPATH:\"";
libMultiLineOptions += cmSystemTools::HandleNetworkPaths(i->c_str()); libMultiLineOptions += lpath;
libMultiLineOptions += "/$(INTDIR)\" "; libMultiLineOptions += "/$(INTDIR)\" ";
libMultiLineOptions += " /LIBPATH:\""; libMultiLineOptions += " /LIBPATH:\"";
libMultiLineOptions += cmSystemTools::HandleNetworkPaths(i->c_str()); libMultiLineOptions += lpath;
libMultiLineOptions += "\" \n"; libMultiLineOptions += "\" \n";
} }
}
// find link libraries // find link libraries
const cmTarget::LinkLibraries& libs = target.GetLinkLibraries(); const cmTarget::LinkLibraries& libs = target.GetLinkLibraries();
cmTarget::LinkLibraries::const_iterator j; cmTarget::LinkLibraries::const_iterator j;