[vtkusers] find VTK library dependencies automatically

Dr. X xunlei at renci.org
Mon Feb 7 12:23:37 EST 2011


Thanks, John.
Does that mean I need to manually append all the dependent libraries 
into CMakeLists.txt?

> FIND_PACKAGE(VTK REQUIRED)
> IF(NOT VTK_FOUND)
>     MESSAGE(FATAL_ERROR "Package VTK required, but it is not found!")
> endif(NOT VTK_FOUND)
> INCLUDE(${VTK_USE_FILE})
>
> LINK_DIRECTORIES(${VTK_LIBRARY_DIRS})
>
> FIND_LIBRARY(VTK_LIBRARIES
>     NAME vtkCommon vtkIO vtkViews vtkRendering
>     HINTS ${VTK_LIBRARY_DIRS}
> )
>
> SET(EXT_LIBRARIES_DEBUG ${EXT_LIBRARIES_DEBUG}
>     ${VTK_LIBRARIES}
> )
>
> SET(EXT_LIBRARIES_RELEASE ${EXT_LIBRARIES_RELEASE}
>     ${VTK_LIBRARIES}
> )

Best,
x



On 2/7/2011 12:15 PM, John Drescher wrote:
>> Would you please give me some hint on how to find out VTK library
>> dependencies (automatically)?
>> When I build an application involving VTK, there are in general many
>> libraries to be included. I don't quite know which library a particular VTK
>> class belongs to.
> There is no automatic way however it is easy to figure out. The
> library needed for any class is the same name as the folder containing
> the source code for the class prepended with vtk.
>
> John




More information about the vtkusers mailing list