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

Williams, Norman K norman-k-williams at uiowa.edu
Tue Sep 30 10:14:15 EDT 2014


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.

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).




________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged.  If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited.  Please reply to the sender that you have received the message in error, then delete it.  Thank you.
________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20140930/0d2923a0/attachment-0001.html>


More information about the cmake-developers mailing list