There is a utility to determine the VTK module dependencies for a source file. You can run
python <vtk-source-directory>/Utilities/Maintenance/FindNeededModules.py \
-j <vtk-build-directory>/modules.json -s <your source file>
Run on the VTK source file Filters/Modeling/Testing/Cxx/TestRotationalExtrusion.cxx
, it produces
find_package(VTK
COMPONENTS
CommonCore
FiltersCore
FiltersModeling
FiltersSources
RenderingCore
TestingCore
TestingRendering
# These modules are suggested since they implement an existing module.
# Uncomment those you need.
# FiltersParallel # implements VTK::FiltersCore
# FiltersParallelGeometry # implements VTK::FiltersCore
# InteractionStyle # implements VTK::RenderingCore
# RenderingFreeType # implements VTK::RenderingCore
# RenderingOpenGL2 # implements VTK::RenderingCore
# RenderingUI # implements VTK::RenderingCore
)
While this generates a find_package
call meant for use in CMake, you can extract the module names listed under COMPONENTS, prepend “vtk” onto them, and you’ve got at least the module dependencies.