[CMake] cannot link vtkIO

Yixun Liu enjoywm at cs.wm.edu
Wed Feb 18 08:26:34 EST 2009


Hi,
I developed an application, which has many CMakeList,  based on VTK. One of CMakelist files is like the
following,

#FIND_PACKAGE(VTK REQUIRED)
#INCLUDE(${VTK_USE_FILE})

...

  TARGET_LINK_LIBRARIES(TetrahedrisationNG
    Basics
    Graphics2DNG
    Graphics3DNG
    vtkIO
    vtkCommon
        )

The error is
/usr/lib64/gcc/x86_64-suse-linux/4.2.1/../../../../x86_64-suse-linux/bin/ld:
cannot find -lvtkIO

However, I can successfully make vtk example using the following CMakeList.

PROJECT (BlockMatchingGPU)

FIND_PACKAGE(VTK REQUIRED)
IF(NOT VTK_USE_RENDERING)
  MESSAGE(FATAL_ERROR "Example ${PROJECT_NAME} requires VTK_USE_RENDERING.")
ENDIF(NOT VTK_USE_RENDERING)
INCLUDE(${VTK_USE_FILE})


FIND_PACKAGE (ITK)
IF (ITK_FOUND)
INCLUDE(${USE_ITK_FILE} )
ENDIF(ITK_FOUND)


ADD_EXECUTABLE(BlockMatchingGPU BlockMatchingGPU.cxx)


TARGET_LINK_LIBRARIES(BlockMatchingGPU ITKBasicFilters ITKCommon ITKIO vtkRendering vtkGraphics vtkHybrid vtkImaging vtkIO vtkFiltering vtkCommon)

The application has many CMakeList. I don't know whether I add FIND_PACKAGE
into the correct CMakeList.

Thanks.

Yixun



More information about the CMake mailing list