diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2002-01-17 17:54:56 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2002-01-17 17:54:56 (GMT) |
commit | 3df3d839ccf5430e6c033ab4f0745d5f2e65d8c6 (patch) | |
tree | 715cde362c43fe24c9714f1bfc61cb8c3d2b75c7 /Source/cmDSPWriter.cxx | |
parent | 46881989961dd54b8ba66cfd6ff950ddf54742f6 (diff) | |
download | CMake-3df3d839ccf5430e6c033ab4f0745d5f2e65d8c6.zip CMake-3df3d839ccf5430e6c033ab4f0745d5f2e65d8c6.tar.gz CMake-3df3d839ccf5430e6c033ab4f0745d5f2e65d8c6.tar.bz2 |
ENH: only output each link path once
Diffstat (limited to 'Source/cmDSPWriter.cxx')
-rw-r--r-- | Source/cmDSPWriter.cxx | 93 |
1 files changed, 56 insertions, 37 deletions
diff --git a/Source/cmDSPWriter.cxx b/Source/cmDSPWriter.cxx index 25194c4..d1bb6ef 100644 --- a/Source/cmDSPWriter.cxx +++ b/Source/cmDSPWriter.cxx @@ -550,6 +550,8 @@ void cmDSPWriter::WriteDSPHeader(std::ostream& fout, const char *libName, const cmTarget &target, std::vector<cmSourceGroup> &) { + std::set<std::string> pathEmitted; + // determine the link directories std::string libOptions; std::string libDebugOptions; @@ -578,18 +580,22 @@ void cmDSPWriter::WriteDSPHeader(std::ostream& fout, const char *libName, { libPath += "/"; } - libOptions += " /LIBPATH:\""; - libOptions += cmSystemTools::HandleNetworkPaths(libPath.c_str()); - libOptions += "$(INTDIR)\" "; - libOptions += " /LIBPATH:\""; - libOptions += cmSystemTools::HandleNetworkPaths(libPath.c_str()); - libOptions += "\" "; - libMultiLineOptions += "# ADD LINK32 /LIBPATH:\""; - libMultiLineOptions += cmSystemTools::HandleNetworkPaths(libPath.c_str()); - libMultiLineOptions += "$(INTDIR)\" "; - libMultiLineOptions += " /LIBPATH:\""; - libMultiLineOptions += cmSystemTools::HandleNetworkPaths(libPath.c_str()); - libMultiLineOptions += "\" \n"; + std::string lpath = cmSystemTools::HandleNetworkPaths(libPath.c_str()); + if(pathEmitted.insert(lpath).second) + { + libOptions += " /LIBPATH:\""; + libOptions += lpath; + libOptions += "$(INTDIR)\" "; + libOptions += " /LIBPATH:\""; + libOptions += lpath; + libOptions += "\" "; + libMultiLineOptions += "# ADD LINK32 /LIBPATH:\""; + libMultiLineOptions += lpath; + libMultiLineOptions += "$(INTDIR)\" "; + libMultiLineOptions += " /LIBPATH:\""; + libMultiLineOptions += lpath; + libMultiLineOptions += "\" \n"; + } } if(exePath.size()) { @@ -598,37 +604,50 @@ void cmDSPWriter::WriteDSPHeader(std::ostream& fout, const char *libName, { exePath += "/"; } - libOptions += " /LIBPATH:\""; - libOptions += cmSystemTools::HandleNetworkPaths(exePath.c_str()); - libOptions += "$(INTDIR)\" "; - libOptions += " /LIBPATH:\""; - libOptions += cmSystemTools::HandleNetworkPaths(exePath.c_str()); - libOptions += "\" "; - libMultiLineOptions += "# ADD LINK32 /LIBPATH:\""; - libMultiLineOptions += cmSystemTools::HandleNetworkPaths(exePath.c_str()); - libMultiLineOptions += "$(INTDIR)\" "; - libMultiLineOptions += " /LIBPATH:\""; - libMultiLineOptions += cmSystemTools::HandleNetworkPaths(exePath.c_str()); - libMultiLineOptions += "\" \n"; + std::string lpath = cmSystemTools::HandleNetworkPaths(exePath.c_str()); + if(pathEmitted.insert(lpath).second) + { + libOptions += " /LIBPATH:\""; + libOptions += lpath; + libOptions += "$(INTDIR)\" "; + libOptions += " /LIBPATH:\""; + libOptions += lpath; + libOptions += "\" "; + libMultiLineOptions += "# ADD LINK32 /LIBPATH:\""; + libMultiLineOptions += lpath; + libMultiLineOptions += "$(INTDIR)\" "; + libMultiLineOptions += " /LIBPATH:\""; + libMultiLineOptions += lpath; + libMultiLineOptions += "\" \n"; + } } std::vector<std::string>::iterator i; std::vector<std::string>& libdirs = m_Makefile->GetLinkDirectories(); for(i = libdirs.begin(); i != libdirs.end(); ++i) { - libOptions += " /LIBPATH:\""; - libOptions += cmSystemTools::HandleNetworkPaths(i->c_str()); - libOptions += "/$(INTDIR)\" "; - libOptions += " /LIBPATH:\""; - libOptions += cmSystemTools::HandleNetworkPaths(i->c_str()); - libOptions += "\" "; - - libMultiLineOptions += "# ADD LINK32 /LIBPATH:\""; - libMultiLineOptions += cmSystemTools::HandleNetworkPaths(i->c_str()); - libMultiLineOptions += "/$(INTDIR)\" "; - libMultiLineOptions += " /LIBPATH:\""; - libMultiLineOptions += cmSystemTools::HandleNetworkPaths(i->c_str()); - libMultiLineOptions += "\" \n"; + std::string lpath = cmSystemTools::HandleNetworkPaths(i->c_str()); + if(lpath[lpath.size()-1] != '/') + { + lpath += "/"; + } + if(pathEmitted.insert(lpath).second) + { + libOptions += " /LIBPATH:\""; + libOptions += lpath; + libOptions += "/$(INTDIR)\" "; + libOptions += " /LIBPATH:\""; + libOptions += lpath; + libOptions += "\" "; + + libMultiLineOptions += "# ADD LINK32 /LIBPATH:\""; + libMultiLineOptions += lpath; + libMultiLineOptions += "/$(INTDIR)\" "; + libMultiLineOptions += " /LIBPATH:\""; + libMultiLineOptions += lpath; + libMultiLineOptions += "\" \n"; + } } + // find link libraries const cmTarget::LinkLibraries& libs = target.GetLinkLibraries(); cmTarget::LinkLibraries::const_iterator j; |