summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2002-04-29 14:23:29 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2002-04-29 14:23:29 (GMT)
commitecbc720829871ef0c0bf5e9cfb099e42e07fee4a (patch)
tree930918050e3aad11a7f5cc7a159988487c5ffaa0
parentb0dd81e665846d8187ba83d8d39eb26fcdf2ec86 (diff)
downloadCMake-ecbc720829871ef0c0bf5e9cfb099e42e07fee4a.zip
CMake-ecbc720829871ef0c0bf5e9cfb099e42e07fee4a.tar.gz
CMake-ecbc720829871ef0c0bf5e9cfb099e42e07fee4a.tar.bz2
BUG: make sure link directories are not duplicated
-rw-r--r--Source/cmMakefile.cxx21
1 files changed, 18 insertions, 3 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index ecfcb24..db4a7e5 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -539,10 +539,25 @@ void cmMakefile::AddLinkDirectory(const char* dir)
// linear search results in n^2 behavior, but n won't be getting
// much bigger than 20. We cannot use a set because of order
// dependency of the link search path.
- if(std::find(m_LinkDirectories.begin(),
- m_LinkDirectories.end(), dir) == m_LinkDirectories.end())
+
+ // remove trailing slashes
+ if(dir && dir[strlen(dir)-1] == '/')
+ {
+ std::string newdir = dir;
+ newdir = newdir.substr(0, newdir.size()-1);
+ if(std::find(m_LinkDirectories.begin(),
+ m_LinkDirectories.end(), newdir.c_str()) == m_LinkDirectories.end())
+ {
+ m_LinkDirectories.push_back(newdir);
+ }
+ }
+ else
{
- m_LinkDirectories.push_back(dir);
+ if(std::find(m_LinkDirectories.begin(),
+ m_LinkDirectories.end(), dir) == m_LinkDirectories.end())
+ {
+ m_LinkDirectories.push_back(dir);
+ }
}
}