VTK_USE_FILE

I just upgraded from VTK-8.1.2 to VTK-9.0.0 and am getting a new segmentation fault:

[2A4FCA]vtkRayCastImageDisplayH:20
WARN| Error: no override found for ‘vtkRayCastImageDisplayHelper’.
Segmentation fault: 11

The offending line in my code is
m_smartVolumeMapperSurfaceRendered = vtkSmartPointer::New();

where the smart pointer has been declared in the corresponding .h file
vtkSmartPointer m_smartVolumeMapperSurfaceRendered;

I’m wondering if it is because, to get CMake to Configure and Generate, I had to remove the depreciated line in my CMake file

include(${VTK_USE_FILE})

but have not replaced it with anything.

Otherwise, it seems strange that I suddenly can’t declare a vtkSmartVolumeMapper object after upgrading VTK.

Any help would be appreciated.

You’ll need to use the autoinit macros to do the work that find_package used to do behind the scenes.

target_link_libraries(mytarget ${any_vis} VTK::ModuleName1 VTK::ModuleName2)
# Add the following line.
vtk_module_autoinit(TARGETS mytarget MODULES VTK::ModuleName1 VTK::ModuleName2)

That worked!! Here are the two key lines in my CMake file for my project “bonezone”

target_link_libraries(bonezone ${Glue} ${VTK_LIBRARIES} ${ITK_LIBRARIES} ${OpenCV_LIBS})
vtk_module_autoinit(TARGETS bonezone MODULES ${VTK_LIBRARIES} )

Many thanks.