Home > front end >  CMake error: Could not find the VTK package with the following required components:GUISupportQt, Vie
CMake error: Could not find the VTK package with the following required components:GUISupportQt, Vie

Time:04-10

I compiled VTK in my RedHat 8.3 machine, and now when I want to compile an example in the /GUI/Qt/SimpleView with cmake I get the following error message when configuring:

CMake Warning at CMakeLists.txt:4 (find_package):
Found package configuration file:
home/user/Downloads/VTK-9.1.0/build/lib64/cmake/vtk-9.1/vtk-config.cmake
but it set VTK_FOUND to FALSE so package “VTK” is considered to be NOT FOUND.
Reason given by package:
Could not find the VTK package with the following required components:
GUISupportQt, ViewsQt.

Has anyone encountered this problem before ?

Thank you for your help.

CodePudding user response:

This looks like you did not set the VTK_MODULE_ENABLE_VTK_GuiSupportQt and VTK_MODULE_ENABLE_VTK_ViewsQt options to "YES" when running configure in CMake.

These options are not enabled by default, but they seem to be required by the example that you're trying to compile.

Don't worry, you shouldn't have to re-do everything now. To fix:

  • Open the CMake GUI.
  • Enter the folder where you built VTK in "Where to build the binaries".
  • If it's not checked, set the "Advanced" checkbox (the required options are not visible otherwise).
  • Set VTK_MODULE_ENABLE_VTK_GuiSupportQt and VTK_MODULE_ENABLE_VTK_ViewsQt options to "YES"
  • Press "Configure", and wait for it to finish
  • During Configuring, you might get an error, if CMake doesn't know how to find Qt; if so, enter the Qt5_DIR / Qt6_DIR, and press configure again.
  • Press "Generate", and wait for it to finish
  • Start the vtk build again (depends on what build tool you choose...)
  • Try configuring the example again, now you should not see the error message anymore.
  • Related