[vtkusers] add shared library to vtk cmake project

Liam Kurmos quantum.leaf at gmail.com
Sun May 8 08:34:43 EDT 2011


Hi All,    (apologies, previous message sent prematurely)

i hope it's ok to ask this question which is primarily a cmake question.

my cmake knowledge is fairly minimal. Now I want to link against a
external library when i build my project.

I have configured this lib in the linker with ldconfig but when i
build my project i get a linker error:
/usr/bin/ld: cannot find -ltourtre

apparently ldconfig is only for run-time linking and so i need to tell
cmake about the library.

first i tried
TARGET_LINK_LIBRARIES(testOVAS vtkWidgets vtkRendering vtkHybrid vnl tourtre)
to add libtourtre but this fails, presumably because there is no
FindTourtre.cmake module.

writing a cmake module looks fairly indepth, and i would like to avoid
it for simply adding a single shared library to my build (which does
need to be widely distributed)

i have played with:

find_library(tourtre_LIBRARY NAMES tourtre PATHS
"/path/libtourtre_v15/libtourtre")

and

link_directories("/path/libtourtre_v15/libtourtre")

without success.

is there a simple line i can add to my CMakeList.txt to add a library path?

cheers

Liam



More information about the vtkusers mailing list