[ITK-dev] find_package issues with ITK and VTK (and SlicerExecution Model)

Matt McCormick matt.mccormick at kitware.com
Tue Sep 30 12:59:39 EDT 2014


Hi Kent,

On Tue, Sep 30, 2014 at 10:14 AM, Williams, Norman K
<norman-k-williams at uiowa.edu> wrote:
> This is a problem that has been cropping up in our projects that use ITK,
> VTK and SlicerExecutionModel.
>
> You won’t see it UNLESS you turn on the ITKVTK/ITKVtkGlue modules.
>
> The problem is this: if you find packages in this order:
>
> find_package(VTK REQUIRED)
> find_package(ITK REQUIRED)
>
> You can’t real compile anything that needs VTK, because down in the ITK
> deployment stuff, it calls find_package(VTK) like this:
> find_package(VTK COMPONENTS
>   vtkCommonCore
>   vtkRenderingCore
>   vtkRenderingOpenGL
>   vtkRenderingFreeType
>   vtkInteractionStyle
>   vtkIOImage
>   vtkImagingSources
>   REQUIRED)
>
> Which blows away the larger list of include directories and libraries that
> the first find_package(VTK REQUIRED) built.
>
> Even better — or worse —
> Modules/Segmentation/LevelSetsv4Visualization/CMakeLists.txt also include
> find_package(VTK) — so ITK tries to import VTK twice, with different module
> lists.
>
> It doesn’t even help to reverse the order:
> find_package(ITK REQUIRED)
> find_package(VTK REQUIRED)
>
> because apparently there’s some hangover from the find_package(VTK) inside
> the ITK CMake deployment files.  The only thing that works is to use
> COMPONENTS, i.e.
>
> find_package(ITK REQUIRED)
> find_package(VTK COMPONENTS vtkCommonCore vtkRenderingAnnotation … REQUIRED)
>
> Which seems to trigger a proper re-scan and build of the library/include
> lists.

This was discussed in this thread [1].  There does not seem to be
interest at this time to have mixed COMPONENTS / non-COMPONENTS calls
to find_package.  It is also recommended to use the MODULE option to
find_package.  A "newer" version of VTK 6 is also required.

> It gets even worse if you use find_package(SlicerExecutionModel) after
> find_package(ITK), for the same reason — SlicerExecutionModel depends on
> ITK, so it clobbers the include/library lists from the first
> find_package(ITK).
>

A patch was merged a few days ago that might address this issue [2].
Is this behavior still see with current ITK?

Thanks,
Matt


[1] http://public.kitware.com/pipermail/vtk-developers/2014-September/015376.html

[2] http://review.source.kitware.com/#/c/16963/


More information about the Insight-developers mailing list