summaryrefslogtreecommitdiffstats
path: root/Source/cmUnixMakefileGenerator.cxx
diff options
context:
space:
mode:
authorAmitha Perera <perera@cs.rpi.edu>2001-06-06 02:54:42 (GMT)
committerAmitha Perera <perera@cs.rpi.edu>2001-06-06 02:54:42 (GMT)
commit84edcba84806c360cc1808d0056be7f4be5d1774 (patch)
tree259b9bc11b9ace1bbc173222cf6d4123b549165f /Source/cmUnixMakefileGenerator.cxx
parent22270abae54796b9ac6991f2c02a5ea56ae4bd33 (diff)
downloadCMake-84edcba84806c360cc1808d0056be7f4be5d1774.zip
CMake-84edcba84806c360cc1808d0056be7f4be5d1774.tar.gz
CMake-84edcba84806c360cc1808d0056be7f4be5d1774.tar.bz2
ENH: Compress the library search directories so that each appears only once.
Diffstat (limited to 'Source/cmUnixMakefileGenerator.cxx')
-rw-r--r--Source/cmUnixMakefileGenerator.cxx29
1 files changed, 20 insertions, 9 deletions
diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx
index 5f8c399..ffcf4c5 100644
--- a/Source/cmUnixMakefileGenerator.cxx
+++ b/Source/cmUnixMakefileGenerator.cxx
@@ -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();
@@ -260,16 +263,20 @@ void cmUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
std::string libpath = cmSystemTools::EscapeSpaces(libDir->c_str());
if(libpath != "/usr/lib")
{
- std::string::size_type pos = libDir->find("-L");
- if((pos == std::string::npos || pos > 0)
- && libDir->find("${") == std::string::npos)
+ if(emitted.insert(libpath).second)
{
- linkLibs += "-L";
+ std::string::size_type pos = libDir->find("-L");
+ if((pos == std::string::npos || pos > 0)
+ && libDir->find("${") == std::string::npos)
+ {
+ linkLibs += "-L";
+ }
+ linkLibs += libpath;
+ linkLibs += " ";
}
- linkLibs += libpath;
- linkLibs += " ";
}
}
+
std::string librariesLinked;
const cmTarget::LinkLibraries& libs = tgt.GetLinkLibraries();
cmRegularExpression reg("lib(.*)(\\.so$|\\.a|\\.sl$)");
@@ -294,9 +301,12 @@ void cmUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
std::string libpath = cmSystemTools::EscapeSpaces(dir.c_str());
if(libpath != "/usr/lib")
{
- linkLibs += "-L";
- linkLibs += libpath;
- linkLibs += " ";
+ 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)