Compiling Issue with ITKVtkGlue

Hi everyone

I like to compile Plastimatch with ITK/VTK.

During the configuration, I got following error:

Plastimatch version is 1.9.4-49-g581c7692
CMake Error at //lib/cmake/ITK-5.3/Modules/ITKVtkGlue.cmake:16 (find_package):
   Could not find a package configuration file provided by "VTK" with any of
   the following names:

     VTKConfig.cmake
     vtk-config.cmake

   Add the installation prefix of "VTK" to CMAKE_PREFIX_PATH or set "VTK_DIR"
   to a directory containing one of the above files.  If "VTK" provides a
   separate development package or SDK, be sure it has been installed.
Call Stack (most recent call first):
   //lib/cmake/ITK-5.3/ITKModuleAPI.cmake:76 (include)
   //lib/cmake/ITK-5.3/ITKModuleAPI.cmake:31 (itk_module_load)
   //lib/cmake/ITK-5.3/ITKModuleAPI.cmake:129 (_itk_module_config_recurse)
   /lib/cmake/ITK-5.3/ITKConfig.cmake:88 (itk_module_config)
   CMakeLists.txt:585 (find_package)

Configuring incomplete, errors occurred!

My setup:
OS: RHEL 8.8
CMAKE: 3.20.2
VTK: 9.0.1 (vtk-devel, from repo epel)
ITK: 5.3.0 (source: GitHub - InsightSoftwareConsortium/ITK: Insight Toolkit (ITK) -- Official Repository. ITK builds on a proven, spatially-oriented architecture for processing, segmentation, and registration of scientific images in two, three, or more dimensions.)
ccmake3 ../itk -DCMAKE_INSTALL_PREFIX=/ITK/itk-distrib -DBUILD_SHARED_LIBS=ON -DModule_ITKVtkGlue=ON -DModule_ITKReview=ON -DModule_SimpleITKFilters=ON -DCMAKE_BUILD_TYPE:STRING=Release
Cuda: 11.8.0
gdcm: compiled from source
dcmtk: compiled from source

I understand that this is the ITK-Forum. But since I got the issue from ITKVtkGlue, I tried first here.
What should I consider if I try to deploy ITK (VTK) for Plastimatch?

Thanks a lot.

BR,
Martin

You can point the ITK build to VTK’s location by setting VTK_DIR, as the error suggests.

You could for example add it in your command line, as follows:

ccmake3 ../itk -DCMAKE_INSTALL_PREFIX=/ITK/itk-distrib -DBUILD_SHARED_LIBS=ON -DModule_ITKVtkGlue=ON -DModule_ITKReview=ON -DModule_SimpleITKFilters=ON -DCMAKE_BUILD_TYPE:STRING=Release -DVTK_DIR=/usr/lib64/cmake/vtk

As far as I can see, vtk-devel should install the cmake files into /usr/lib64/cmake/vtk (and /usr/lib/cmake/vtk) - check the output of dnf repoquery -l vtk-devel | grep "vtk-config[.]cmake" if that is not working for you.

1 Like

I have a very similar problem, building (with VS 2010) a small program that uses ITK.
VTK is installed at E:\VTK-VS10, I have the env variable VTK_DIR set to this, and VTKConfig.cmake is in:
VTK-VS10\lib\vtk-5.10. I added this line to CMakeLists.txt:

set (VTK_DIR E:/VTK-VS10/lib/vtk-5.10)

but the error message is unchanged:

CMake Error at C:/ITK4.8.0/lib/cmake/ITK-4.8/Modules/ITKVtkGlue.cmake:9 (find_package):
Could not find a package configuration file provided by “VTK” with any of
the following names:

VTKConfig.cmake
vtk-config.cmake

Add the installation prefix of “VTK” to CMAKE_PREFIX_PATH or set “VTK_DIR”
to a directory containing one of the above files. If “VTK” provides a
separate development package or SDK, be sure it has been installed.