Ken Martin 22 سال پیش
والد
کامیت
590460aaae
2فایلهای تغییر یافته به همراه27 افزوده شده و 0 حذف شده
  1. 22 0
      Source/cmSystemTools.cxx
  2. 5 0
      Source/cmSystemTools.h

+ 22 - 0
Source/cmSystemTools.cxx

@@ -1703,6 +1703,28 @@ bool cmSystemTools::FileIsDirectory(const char* name)
     }
 }
 
+bool cmSystemTools::DoesFileExistWithExtensions(
+  const char* name,
+  const std::vector<std::string>& headerExts)
+{
+  std::string hname;
+
+  for( std::vector<std::string>::const_iterator ext = headerExts.begin();
+       ext != headerExts.end(); ++ext )
+    {
+    hname = name;
+    hname += ".";
+    hname += *ext;
+    if(cmSystemTools::FileExists(hname.c_str()))
+      {
+      return true;
+      }
+    }
+  return false;
+}
+
+
+
 int cmSystemTools::ChangeDirectory(const char *dir)
 {
   return Chdir(dir);

+ 5 - 0
Source/cmSystemTools.h

@@ -244,6 +244,11 @@ public:
 
   ///! return true if the file is a directory.
   static bool FileIsDirectory(const char* name);
+
+  static bool DoesFileExistWithExtensions(
+    const char *name,
+    const std::vector<std::string>& sourceExts);
+
   static void Glob(const char *directory, const char *regexp,
                    std::vector<std::string>& files);
   static void GlobDirs(const char *fullPath, std::vector<std::string>& files);