Build error in VTK-based project: "include called with wrong number of arguments. include() only takes one file."

I’m making progress with building 3D Slicer with VTK master.

Now build fails where a VTK-based library is configured. The error message is:

include called with wrong number of arguments. include() only takes one file.

After some digging and internet search it turned out that it caused trouble at a number of other projects, too (VTK examples, PCL, etc).

The solution is to delete include(${VTK_USE_FILE}), which was necessary for building with older VTK versions.

To make transition of projects to VTK-8.9 easier and avoid unnecessary developer frustration, please create a dummy VTK_USE_FILE that prints a meaningful warning message (or prints an error message and aborts the build). This mechanism only need to kept until most projects make their transition (can be removed in a couple of years).

1 Like

Also, ˋUtilities/Maintenance/FindNeededModules.pyˋ is useful for determining what modules are needed. It generates a find_package(VTK COMPONENTS …) command for CMake. It is specific for the VTK master i.e. 8.90 and more recent.

1 Like

Submitted an issue on VTK bugtracker to track this: https://gitlab.kitware.com/vtk/vtk/issues/17725