void-packages/srcpkgs/freecad/patches/152-cmake-vtk9.patch

54 lines
2.1 KiB
Diff

--- a/cMake/FreeCAD_Helpers/SetupSalomeSMESH.cmake 2020-11-26 15:59:27.000000000 +0100
+++ b/cMake/FreeCAD_Helpers/SetupSalomeSMESH.cmake 2020-11-26 23:09:12.778262636 +0100
@@ -11,6 +11,8 @@
set(SMESH_VERSION_TWEAK 0)
#if we use smesh we definitely also need vtk, no matter of external or internal smesh
+ find_package(VTK REQUIRED NO_MODULE)
+ if(${VTK_MAJOR_VERSION} LESS 9)
set (VTK_COMPONENTS
vtkCommonCore
vtkCommonDataModel
@@ -23,18 +25,37 @@
vtkFiltersSources
vtkFiltersGeometry
)
-
- # check which modules are available
- if(UNIX OR WIN32)
find_package(VTK COMPONENTS vtkCommonCore REQUIRED NO_MODULE)
list(APPEND VTK_COMPONENTS vtkIOMPIParallel vtkParallelMPI vtkhdf5 vtkFiltersParallelDIY2 vtkRenderingCore vtkInteractionStyle vtkRenderingFreeType vtkRenderingOpenGL2)
+ else()
+ # VTK 9 changed its component names
+ set (VTK_COMPONENTS
+ CommonCore
+ CommonDataModel
+ FiltersVerdict
+ IOXML
+ FiltersCore
+ FiltersGeneral
+ IOLegacy
+ FiltersExtraction
+ FiltersSources
+ FiltersGeometry
+ )
+ find_package(VTK COMPONENTS CommonCore REQUIRED NO_MODULE)
+ list(APPEND VTK_COMPONENTS IOMPIParallel ParallelMPI hdf5 FiltersParallelDIY2 RenderingCore InteractionStyle RenderingFreeType RenderingOpenGL2)
+ endif()
+
+ # check which modules are available
foreach(_module ${VTK_COMPONENTS})
+ if(${VTK_MAJOR_VERSION} LESS 9)
list (FIND VTK_MODULES_ENABLED ${_module} _index)
+ else()
+ list (FIND VTK_AVAILABLE_COMPONENTS ${_module} _index)
+ endif()
if (${_index} GREATER -1)
list(APPEND AVAILABLE_VTK_COMPONENTS ${_module})
endif()
endforeach()
- endif()
# don't check VERSION 6 as this would exclude VERSION 7
if(AVAILABLE_VTK_COMPONENTS)