[vtk-developers] FindPackage not working in new module system

Ben Boeckel ben.boeckel at kitware.com
Thu Jan 10 13:37:23 EST 2019


On Thu, Jan 10, 2019 at 12:24:07 -0500, Aron Helser wrote:
> Sorry, I should have started with the original problem. I started with this
> file:
> 
> cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
> PROJECT (mineview)
> find_package(VTK REQUIRED)
> vtk_module_config(VTK
>   vtkCommonCore
>   vtkCommonDataModel
>   vtkFiltersGeneral
>   vtkIOFFMPEG
>   vtkIOImage
>   vtkIOXML
>   vtkInteractionStyle
>   vtkRenderingOpenGL2
>   vtkRenderingOpenVR
> )
> include(${VTK_USE_FILE})
> 
> add_executable(mineview MACOSX_BUNDLE mineview.cxx Lobby.cxx View.cxx
> AudioHandler.cxx)
> target_link_libraries(mineview ${VTK_LIBRARIES} Xaudio2.lib opengl32
> winmm.lib)
> 
> but "vtk_module_config" doesn't exist anymore, right? So I tried to change
> to this:
> find_package(VTK
>   COMPONENTS
>   vtkCommonCore
>  ...
> 
> but then it complains:
> 
> CMake Warning at CMakeLists.txt:5 (find_package):
> Found package configuration file:
> 
> C:/akit/vtk/build/lib/cmake/vtk-8.90/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:
> vtkCommonCore.
> 
> 
> Thus I am confused. :)
> Hope those breadcrumbs help?

COMPONENTS are now `CommonCore` and `FiltersGeneral` since they end up
like `VTK::CommonCore`. I suppose the components list could be
preprocessed to detect a leading `vtk` and remove it (warning that that
name is deprecated).

--Ben


More information about the vtk-developers mailing list