[vtkusers] Using VTK with CMake: link errors

Nicholas Kinar n.kinar at usask.ca
Tue Aug 10 17:08:19 EDT 2010


> This is all that is typically needed:
>
> PROJECT(Test)
>
> FIND_PACKAGE(VTK REQUIRED)
> INCLUDE(${VTK_USE_FILE})
>
> ADD_EXECUTABLE(Test Test.cxx)
> TARGET_LINK_LIBRARIES(Test vtkHybrid)
>
> The meaning of those errors is pretty self explanatory, but I have no
> idea how to fix it, sorry.
>
> Thanks,
>
> David
>
>    
  Yes - this looks very reasonable, and modifying the CMakeLists.txt 
script in the following fashion also produced the same link errors on 
Mac OS X:

cmake_minimum_required (VERSION 2.6)
project (fdtd-cuda-1)
find_package(VTK REQUIRED)
include( ${VTK_USE_FILE} )
include_directories(/Volumes/FILES/CODE-LIBRARY/utilities)
include_directories(/Volumes/FILES/Programs/common/TNT)
include_directories(/Volumes/FILES/Programs/common/boost/boost_1_43_0)
include (${VTK_USE_FILE})
add_executable (fdtd-cuda-1 main.cpp)
target_link_libraries(fdtd-cuda-1 vtkHybrid)

I'll try pulling the most recent version of CMake from git and try 
compiling the newer version.  Since this might be a platform-specific 
issue with CMake, I'll also give it a try on Windows and GNU/Linux.

David, thank you so much for your help!

Nicholas






More information about the vtkusers mailing list