BUG: do not include /usr/lib in -L

This commit is contained in:
Bill Hoffman 2001-05-22 17:49:18 -04:00
parent 7950871fcb
commit 52e83c7afd
1 changed files with 17 additions and 9 deletions

View File

@ -243,15 +243,19 @@ void cmUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
for(std::vector<std::string>::iterator libDir = libdirs.begin(); for(std::vector<std::string>::iterator libDir = libdirs.begin();
libDir != libdirs.end(); ++libDir) libDir != libdirs.end(); ++libDir)
{ {
std::string libpath = cmSystemTools::EscapeSpaces(libDir->c_str());
if(libpath != "/usr/lib")
{
std::string::size_type pos = libDir->find("-L"); std::string::size_type pos = libDir->find("-L");
if((pos == std::string::npos || pos > 0) if((pos == std::string::npos || pos > 0)
&& libDir->find("${") == std::string::npos) && libDir->find("${") == std::string::npos)
{ {
linkLibs += "-L"; linkLibs += "-L";
} }
linkLibs += cmSystemTools::EscapeSpaces(libDir->c_str()); linkLibs += libpath;
linkLibs += " "; linkLibs += " ";
} }
}
std::string librariesLinked; std::string librariesLinked;
const cmTarget::LinkLibraries& libs = tgt.GetLinkLibraries(); const cmTarget::LinkLibraries& libs = tgt.GetLinkLibraries();
cmRegularExpression reg("lib(.*)(\\.so$|\\.a|\\.sl$)"); cmRegularExpression reg("lib(.*)(\\.so$|\\.a|\\.sl$)");
@ -273,9 +277,13 @@ void cmUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
std::string dir, file; std::string dir, file;
cmSystemTools::SplitProgramPath(lib->first.c_str(), cmSystemTools::SplitProgramPath(lib->first.c_str(),
dir, file); dir, file);
std::string libpath = cmSystemTools::EscapeSpaces(dir.c_str());
if(libpath != "/usr/lib")
{
linkLibs += "-L"; linkLibs += "-L";
linkLibs += cmSystemTools::EscapeSpaces(dir.c_str()); linkLibs += libpath;
linkLibs += " "; linkLibs += " ";
}
librariesLinked += "-l"; librariesLinked += "-l";
cmRegularExpression libname("lib(.*)\\.(.*)"); cmRegularExpression libname("lib(.*)\\.(.*)");
if(libname.find(file)) if(libname.find(file))