ENH: Compress the library search directories so that each appears only once.
This commit is contained in:
parent
22270abae5
commit
84edcba848
|
@ -251,6 +251,9 @@ void cmUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
|
|||
const char* targetLibrary,
|
||||
const cmTarget &tgt)
|
||||
{
|
||||
// Try to emit each search path once
|
||||
std::set<std::string> emitted;
|
||||
|
||||
// collect all the flags needed for linking libraries
|
||||
std::string linkLibs;
|
||||
std::vector<std::string>& libdirs = m_Makefile->GetLinkDirectories();
|
||||
|
@ -259,6 +262,8 @@ void cmUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
|
|||
{
|
||||
std::string libpath = cmSystemTools::EscapeSpaces(libDir->c_str());
|
||||
if(libpath != "/usr/lib")
|
||||
{
|
||||
if(emitted.insert(libpath).second)
|
||||
{
|
||||
std::string::size_type pos = libDir->find("-L");
|
||||
if((pos == std::string::npos || pos > 0)
|
||||
|
@ -270,6 +275,8 @@ void cmUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
|
|||
linkLibs += " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string librariesLinked;
|
||||
const cmTarget::LinkLibraries& libs = tgt.GetLinkLibraries();
|
||||
cmRegularExpression reg("lib(.*)(\\.so$|\\.a|\\.sl$)");
|
||||
|
@ -293,11 +300,14 @@ void cmUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
|
|||
dir, file);
|
||||
std::string libpath = cmSystemTools::EscapeSpaces(dir.c_str());
|
||||
if(libpath != "/usr/lib")
|
||||
{
|
||||
if(emitted.insert(libpath).second)
|
||||
{
|
||||
linkLibs += "-L";
|
||||
linkLibs += libpath;
|
||||
linkLibs += " ";
|
||||
}
|
||||
}
|
||||
cmRegularExpression libname("lib(.*)\\.(.*)");
|
||||
if(libname.find(file))
|
||||
{
|
||||
|
@ -318,6 +328,7 @@ void cmUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
|
|||
librariesLinked += " ";
|
||||
}
|
||||
}
|
||||
|
||||
linkLibs += librariesLinked;
|
||||
|
||||
if(!targetLibrary)
|
||||
|
|
Loading…
Reference in New Issue