浏览代码

ENH: Add another signature to FindProgram that matches more to the one from CMake

Andy Cedilnik 20 年之前
父节点
当前提交
33c891f8d8
共有 2 个文件被更改,包括 21 次插入0 次删除
  1. 16 0
      Source/kwsys/SystemTools.cxx
  2. 5 0
      Source/kwsys/SystemTools.hxx.in

+ 16 - 0
Source/kwsys/SystemTools.cxx

@@ -1947,6 +1947,22 @@ kwsys_stl::string SystemTools::FindProgram(
   return "";
 }
 
+kwsys_stl::string SystemTools::FindProgram(
+  const kwsys_stl::vector<kwsys_stl::string>& names,
+  const kwsys_stl::vector<kwsys_stl::string>& path,
+  bool noSystemPath)
+{
+  for(kwsys_stl::vector<kwsys_stl::string>::const_iterator it = names.begin();
+      it != names.end() ; ++it)
+    {
+    // Try to find the program.
+    std::string result = SystemTools::FindProgram(it->c_str(), 
+                                                  path, 
+                                                  noSystemPath);
+    return result;
+    }
+  return "";
+}
 
 /**
  * Find the library with the given name.  Searches the given path and then

+ 5 - 0
Source/kwsys/SystemTools.hxx.in

@@ -493,6 +493,11 @@ public:
     const kwsys_stl::vector<kwsys_stl::string>& path = 
     kwsys_stl::vector<kwsys_stl::string>(),
     bool no_system_path = false);
+  static kwsys_stl::string FindProgram(
+    const kwsys_stl::vector<kwsys_stl::string>& names,
+    const kwsys_stl::vector<kwsys_stl::string>& path = 
+    kwsys_stl::vector<kwsys_stl::string>(),
+    bool no_system_path = false);
 
   /**
    * Find a library in the system PATH, with optional extra paths