Hi Elvis, I am new to VTK - please could you help - where exactly do you add this line in the CMake file? I am currently just trying to run the Glyph3DImage example, but when I run CMake I get this error: “Skipping Glyph3DImage: Could not find the VTK package with the following required components: RenderingContextOpenGL2.” The CMake file currently looks like this:
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
project(Glyph3DImage)
find_package(VTK COMPONENTS
vtkCommonColor
vtkCommonCore
vtkCommonDataModel
vtkFiltersSources
vtkIOImage
vtkInteractionStyle
vtkRenderingContextOpenGL2
vtkRenderingCore
vtkRenderingFreeType
vtkRenderingGL2PSOpenGL2
vtkRenderingOpenGL2 QUIET)
if (NOT VTK_FOUND)
message("Skipping Glyph3DImage: ${VTK_NOT_FOUND_MESSAGE}")
return ()
endif()
message (STATUS "VTK_VERSION: ${VTK_VERSION}")
if (VTK_VERSION VERSION_LESS "8.90.0")
# old system
include(${VTK_USE_FILE})
add_executable(Glyph3DImage MACOSX_BUNDLE Glyph3DImage.cxx )
target_link_libraries(Glyph3DImage PRIVATE ${VTK_LIBRARIES})
else ()
# include all components
add_executable(Glyph3DImage MACOSX_BUNDLE Glyph3DImage.cxx )
target_link_libraries(Glyph3DImage PRIVATE ${VTK_LIBRARIES})
# vtk_module_autoinit is needed
vtk_module_autoinit(
TARGETS Glyph3DImage
MODULES ${VTK_LIBRARIES}
)
endif ()
Many thanks