summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2001-02-16 16:34:23 (GMT)
committerKen Martin <ken.martin@kitware.com>2001-02-16 16:34:23 (GMT)
commit43859e36cfa3dede4f935ada5ad08ee6e7eb1d76 (patch)
tree622fb609e84cbefa6e34bd2a60bc084ab15b5ab7 /Source/cmSystemTools.cxx
parentfce56c57c497ede3a7afcbc7965846cc8bad9db2 (diff)
downloadCMake-43859e36cfa3dede4f935ada5ad08ee6e7eb1d76.zip
CMake-43859e36cfa3dede4f935ada5ad08ee6e7eb1d76.tar.gz
CMake-43859e36cfa3dede4f935ada5ad08ee6e7eb1d76.tar.bz2
ENH: add new commands fro find library and find program
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r--Source/cmSystemTools.cxx25
1 files changed, 25 insertions, 0 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 1f10cb2..da953ba 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -35,6 +35,31 @@ inline int Mkdir(const char* dir)
}
#endif
+// adds the elements of the env variable path to the arg passed in
+void cmSystemTools::GetPath(std::vector<std::string>& path)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ char* pathSep = ";";
+#else
+ char* pathSep = ":";
+#endif
+ std::string pathEnv = getenv("PATH");
+ std::string::size_type start =0;
+ bool done = false;
+ while(!done)
+ {
+ std::string::size_type endpos = pathEnv.find(pathSep, start);
+ if(endpos != std::string::npos)
+ {
+ path.push_back(pathEnv.substr(start, endpos-start));
+ start = endpos+1;
+ }
+ else
+ {
+ done = true;
+ }
+ }
+}
bool cmSystemTools::MakeDirectory(const char* path)
{