summaryrefslogtreecommitdiffstats
path: root/Source/cmFindCommon.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-06-09 15:57:56 (GMT)
committerBrad King <brad.king@kitware.com>2008-06-09 15:57:56 (GMT)
commitd53e5dec3748e1d800dae595dcb78f2c4d55f788 (patch)
treed53cc056e338a02277753caabfe5ae5bb7a41170 /Source/cmFindCommon.cxx
parent3446bab75eb9a686841ec9bf6683beac603cbde5 (diff)
downloadCMake-d53e5dec3748e1d800dae595dcb78f2c4d55f788.zip
CMake-d53e5dec3748e1d800dae595dcb78f2c4d55f788.tar.gz
CMake-d53e5dec3748e1d800dae595dcb78f2c4d55f788.tar.bz2
ENH: In find_* implementation centralize addition of trailing slashes
- Create cmFindCommon::AddTrailingSlashes - Use it in cmFindBase and cmFindPackageCommand - Remove duplication from other find commands
Diffstat (limited to 'Source/cmFindCommon.cxx')
-rw-r--r--Source/cmFindCommon.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index a82e611..d69fdce 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -417,3 +417,18 @@ void cmFindCommon::AddPathInternal(std::string const& in_path,
this->SearchPaths.push_back(fullPath.c_str());
}
}
+
+//----------------------------------------------------------------------------
+void cmFindCommon::AddTrailingSlashes(std::vector<std::string>& paths)
+{
+ // Add a trailing slash to all paths to aid the search process.
+ for(std::vector<std::string>::iterator i = paths.begin();
+ i != paths.end(); ++i)
+ {
+ std::string& p = *i;
+ if(!p.empty() && p[p.size()-1] != '/')
+ {
+ p += "/";
+ }
+ }
+}