[vtkusers] find_package( ITK ) overrides ${VTK_LIBRARIES} from find_package( VTK )

Pablo Hernández pablo.hernandez.cerdan at outlook.com
Tue Dec 2 17:02:04 EST 2014


Thanks a lot, I have tested Bill suggestion and it worked:
> Or, reset the vtk modules that itk sets using:
> set(VTK_MODULES_REQUESTED "")
> before
> find_package(VTK REQUIRED)

And thanks for pointing out that linking all the libraries is not good, but I've some problems knowing what module corresponds to my #include<vtk**> header.  Is there any wiki page to discover that or any map linking module-library?

Thanks all for the solutions,
Pablo

> Date: Tue, 2 Dec 2014 11:34:20 -0500
> Subject: Re: [vtkusers] find_package( ITK ) overrides ${VTK_LIBRARIES} from find_package( VTK )
> From: cory.quammen at kitware.com
> To: bill.lorensen at gmail.com
> CC: david.gobbi at gmail.com; vtkusers at vtk.org; pablo.hernandez.cerdan at outlook.com
> 
> Pablo,
> 
> I was just looking into this myself after encountering the same behavior.
> 
> If you want to include the VTK libraries needed for ITK and specify an
> additional set of VTK modules in your project, I suggest the
> following:
> 
> find_package(ITK REQUIRED)
> include(${ITK_USE_FILE})
> 
> set(VTK_MODULES_REQUESTED ${VTK_MODULES_REQUESTED} [additional VTK modules])
> find_package(VTK REQUIRED)
> include(${VTK_USE_FILE})
> 
> This should work. VTK_LIBRARIES should be set to only the VTK
> libraries needed for the modules requested by ITK and by you, plus
> their dependencies. Let us know if it doesn't.
> 
> Thanks,
> Cory
> 
> 
> On Tue, Dec 2, 2014 at 8:36 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> > As David said you can explicitly list the modules that your app uses.
> >
> > Or, reset the vtk modules that itk sets using:
> > set(VTK_MODULES_REQUESTED "")
> > before
> > find_package(VTK REQUIRED)
> >
> > On Tue, Dec 2, 2014 at 12:39 AM, David Gobbi <david.gobbi at gmail.com> wrote:
> >> Hi Pablo,
> >>
> >> It's best to only link to the VTK libraries that you need, rather than
> >> trying to
> >> link to them all via ${VTK_LIBRARIES}.
> >>
> >> The reason for the short list is probably that when ITK calls
> >> find_package(),
> >> it only requests the small set of VTK components that ITK uses:
> >> http://www.cmake.org/cmake/help/v2.8.9/cmake.html#command:find_package
> >>
> >>  - David
> >>
> >>
> >> On Mon, Dec 1, 2014 at 10:26 PM, Pablo Hernández
> >> <pablo.hernandez.cerdan at outlook.com> wrote:
> >>>
> >>> I  have a running/compiling CMakeLists.txt when using VTK only, this is
> >>> the related VTK part:
> >>> find_package(VTK 6.2 REQUIRED)
> >>>  message (status "** VTK FOUND: USE_FILES ${VTK_USE_FILE}")
> >>> message (status "** VTK FOUND: VTK_LIBRARIES ${VTK_LIBRARIES}")
> >>>
> >>> include(${VTK_USE_FILE})
> >>> include_directories( ${VTK_INCLUDE_DIRS})
> >>> include_directories(${CMAKE_CURRENT_SOURCE_DIR})
> >>>
> >>> add_executable(VTKNodesEdgesEXE main.cpp ${source_files} ${QT_UI_HEADERS}
> >>> ${QT_RESOURCES})
> >>> target_link_libraries(VTKNodesEdgesEXE ${VTK_LIBRARIES})
> >>> target_link_libraries(VTKNodesEdgesEXE Qt5::Widgets Qt5::PrintSupport)
> >>>
> >>>
> >>> The problem is that if I add find_package(ITK) anywhere, ${VTK_LIBRARIES}
> >>> gets overrides by a tiny list selected by ITK.
> >>
> >>
> >
> >
> >
> > --
> > Unpaid intern in BillsBasement at noware dot com
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://public.kitware.com/mailman/listinfo/vtkusers
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20141202/1719fce2/attachment.html>


More information about the vtkusers mailing list