Просмотр исходного кода

BUG: Added special hack for VTK 4.0-4.4 to re-enable automatic addition of current source directory to -I path.

Brad King 21 лет назад
Родитель
Сommit
491ef99291
1 измененных файлов с 25 добавлено и 3 удалено
  1. 25 3
      Source/cmLocalUnixMakefileGenerator.cxx

+ 25 - 3
Source/cmLocalUnixMakefileGenerator.cxx

@@ -2497,6 +2497,7 @@ void cmLocalUnixMakefileGenerator::OutputMakeVariables(std::ostream& fout)
 
   // CMake versions below 2.0 would add the source tree to the -I path
   // automatically.  Preserve compatibility.
+  bool includeSourceDir = false;
   const char* versionValue =
     m_Makefile->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY");
   if(versionValue)
@@ -2505,11 +2506,32 @@ void cmLocalUnixMakefileGenerator::OutputMakeVariables(std::ostream& fout)
     int minor = 0;
     if(sscanf(versionValue, "%d.%d", &major, &minor) == 2 && major < 2)
       {
-      fout << "-I"
-           << this->ConvertToOutputForExisting(m_Makefile->GetStartDirectory())
-           << " ";
+      includeSourceDir = true;
       }
     }
+  const char* vtkSourceDir =
+    m_Makefile->GetDefinition("VTK_SOURCE_DIR");
+  if(vtkSourceDir)
+    {
+    // Special hack for VTK 4.0 - 4.4.
+    const char* vtk_major = m_Makefile->GetDefinition("VTK_MAJOR_VERSION");
+    const char* vtk_minor = m_Makefile->GetDefinition("VTK_MINOR_VERSION");
+    vtk_major = vtk_major? vtk_major : "4";
+    vtk_minor = vtk_minor? vtk_minor : "4";
+    int major = 0;
+    int minor = 0;
+    if(sscanf(vtk_major, "%d", &major) && sscanf(vtk_minor, "%d", &minor) &&
+       major == 4 && minor <= 4)
+      {
+      includeSourceDir = true;
+      }
+    }
+  if(includeSourceDir)
+    {
+    fout << "-I"
+         << this->ConvertToOutputForExisting(m_Makefile->GetStartDirectory())
+         << " ";
+    }
 
   implicitIncludes["/usr/include"] = "/usr/include";
   if(m_Makefile->GetDefinition("CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES"))