Trying to build SlicerCAT with VTK 9 and I get this error:
CMake Error at CMakeLists.txt:813 (find_package):
Found package configuration file:
/home/kerim/Documents/Colada_prj/d/VTK-build/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:
GUISupportQtOpenGL.
Can’t find a way to turn GUISupportQtOpenGLON.
I can see that External_VTK.cmake has:
i.e. it probably should set GUISupportQtOpenGLON and in my case Slicer_VTK_RENDERING_BACKEND is equal to OpenGL2. I have checked if("${Slicer_VTK_RENDERING_BACKEND}" STREQUAL "OpenGL2") statement returns TRUE.
I guess the thing is that in Slicer’s CMakeLists.txt we have:
set(_default_vtk "8")
set(Slicer_VTK_VERSION_MAJOR ${_default_vtk} CACHE STRING "VTK major version (8 or 9)")
set_property(CACHE Slicer_VTK_VERSION_MAJOR PROPERTY STRINGS "8" "9")
if(NOT "${Slicer_VTK_VERSION_MAJOR}" MATCHES "^(8|9)$")
message(FATAL_ERROR "error: Slicer_VTK_VERSION_MAJOR must be 8 or 9.")
endif()
mark_as_superbuild(Slicer_VTK_VERSION_MAJOR)
I guess this overrides my Slicer_VTK_VERSION_MAJOR that I previously set up in my main SlicerCAT’s CMakeLists.txt and I can see the output right before the error appears:
-- Configuring VTK
-- Slicer_VTK_RENDERING_BACKEND is OpenGL2
-- Slicer_VTK_SMP_IMPLEMENTATION_TYPE is Sequential
-- Slicer_VTK_VERSION_MAJOR is 8
-- Configuring Colada with Qt 5.15.2 (using modules: Core, Widgets, Multimedia, Network, OpenGL, PrintSupport, UiTools, Xml, XmlPatterns, Svg, Sql, WebEngine, WebEngineWidgets, WebChannel, )
-- Setting QT_PLUGINS_DIR: /home/kerim/Qt/5.15.2/gcc_64/plugins
-- Setting QT_BINARY_DIR: /home/kerim/Qt/5.15.2/gcc_64/bin
-- Setting ExternalData_OBJECT_STORES to '/home/kerim/Documents/Colada_prj/d/Slicer-build/ExternalData/Objects'
-- Configuring Colada for [linux-amd64]
CMake Error at CMakeLists.txt:813 (find_package):
Found package configuration file:
/home/kerim/Documents/Colada_prj/d/VTK-build/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:
GUISupportQtOpenGL.
-- Configuring incomplete, errors occurred!
As you can see the Slicer_VTK_VERSION_MAJOR is equal now to 8.
Do I misunderstand something?
but as I noticed in Slicer’s main CMakeLists.txt Slicer_VTK_VERSION_MAJOR is CACHE type.
So to solve my error I simply overwrote the above line with the command:
set(Slicer_VTK_VERSION_MAJOR 9 CACHE STRING "VTK major version (8 or 9)" FORCE)
mark_as_superbuild(Slicer_VTK_VERSION_MAJOR)
Now I for the first time successfully compiled SlicerCAT with VTK 9
@jcfr@Sam_Horvath How can you set the VTK version for a Slicer custom application? @cpinter As far as I remember you had a similar issue. What did you end up doing?
Great, thank you. @keri tried to do this but probably it failed because of a previous configuration with version 8. Your complete working example above should be sufficient for anyone who needs to use a custom VTK version.
Thanks @jcfr this could be potentially quite useful to use as well.
I did not have this specific issue. Maybe what you remember is that I tried to configure an extension used by a custom app with an additional option (still haven’t figured it out btw).