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

Aron Helser aron.helser at kitware.com
Thu Jan 10 12:24:07 EST 2019


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?
Thanks,
Aron


On Thu, Jan 10, 2019 at 12:18 PM Aron Helser <aron.helser at kitware.com>
wrote:

> With a very similar cmake file, I'm seeing the error:
>
> CMake Error at CMakeLists.txt:6 (include):
> include called with wrong number of arguments. include() only takes one
> file.
>
>
> I pointed VTK_Dir at ".....vtk/build/lib/cmake/vtk-8.90" , like you
> suggested. My VTK build does have OpenVR enabled, on windows, so I have to
> set OpenVR_INCLUDE_DIR and OpenVR_LIBRARY.
>
>
> If I change to:
>
>
> include("${VTK_USE_FILE}")
>
>
> It warns that no file was provided, then during compile it can't find VTK
> headers.
>
>
> The find_package(VTK REQUIRED) is going wrong?'
>
>
> What am I doing wrong?
>
> Thanks,
>
> Aron
>
> On Wed, Jan 9, 2019 at 3:06 PM Ben Boeckel via vtk-developers <
> vtk-developers at vtk.org> wrote:
>
>> On Wed, Jan 09, 2019 at 11:44:01 -0800, Bill Lorensen wrote:
>> > TYhis cmake file:
>> > cmake_minimum_required(VERSION 2.8)
>> >
>> > PROJECT(ReadOBJ)
>> >
>> > find_package(VTK REQUIRED)
>> > include(${VTK_USE_FILE})
>> >
>> > add_executable(ReadOBJ MACOSX_BUNDLE ReadOBJ.cxx )
>> >
>> > target_link_libraries(ReadOBJ ${VTK_LIBRARIES})
>> >
>> > I specify the VTK_DIR to point at a new module VTK build. I'm using
>> > cmake version 3.10.3
>>
>> The vtk-config.cmake file is in the `lib/cmake/vtk-*` directory of the
>> build tree, not the top-level. This mirrors the install tree and also
>> keeps the code between the two very similar (instead of having to differ
>> on relative paths to other generated CMake files).
>>
>> --Ben
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>>
>> Follow this link to subscribe/unsubscribe:
>> https://vtk.org/mailman/listinfo/vtk-developers
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtk-developers/attachments/20190110/a1d76c89/attachment.html>


More information about the vtk-developers mailing list