浏览代码

fix for vs6 rule files

Ken Martin 22 年之前
父节点
当前提交
f76d01d56a
共有 1 个文件被更改,包括 23 次插入0 次删除
  1. 23 0
      Source/cmLocalVisualStudio6Generator.cxx

+ 23 - 0
Source/cmLocalVisualStudio6Generator.cxx

@@ -315,6 +315,8 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
     srcFilesToProcess.pop();
     }
 
+  // now all of the source files have been properly assigned to the target
+  // now stick them into source groups using the reg expressions
   for(std::vector<cmSourceFile*>::iterator i = classes.begin(); 
       i != classes.end(); i++)
     {
@@ -323,6 +325,27 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
     cmSourceGroup& sourceGroup = m_Makefile->FindSourceGroup(source.c_str(),
                                                              sourceGroups);
     sourceGroup.AddSource(source.c_str(), *i);
+    // while we are at it, if it is a .rule file then for visual studio 6 we
+    // must generate it
+    if ((*i)->GetSourceExtension() == "rule")
+      {
+      if(!cmSystemTools::FileExists(source.c_str()))
+        {
+#if defined(_WIN32) || defined(__CYGWIN__)
+        std::ofstream fout(source.c_str(), 
+                           std::ios::binary | std::ios::out | std::ios::trunc);
+#else
+        std::ofstream fout(source.c_str(), 
+                           std::ios::out | std::ios::trunc);
+#endif
+        if(fout)
+          {
+          fout.write("# generated from CMake",22);
+          fout.flush();
+          fout.close();
+          }
+        }
+      }
     }
   
   // Write the DSP file's header.