[vtkusers] add shared library to vtk cmake project

Liam Kurmos quantum.leaf at gmail.com
Sun May 8 09:41:12 EDT 2011


sorry to post again, i have an urgent phd deadline and this is holding
me up...(also posted to cmake list)

from the documentation i think it should be possible to do:

LINK_DIRECTORIES( ${LINK_DIRECTORIES} /absPath/libtourtre/)

but i still get lots of undefined references. I have tried a simple non-cmake
example and linked it with -L/absPath/libtourtre/ -ltourtre and it
works fine so i'm at a loss where i'm going wrong.

further note:
if i put link_directories after add executable i dont get undefined
references, just
/usr/bin/ld: cannot find -ltourtre

there must be a simple solution for this but i can't seem to find
despite trawling the web...

Liam




On Sun, May 8, 2011 at 1:34 PM, Liam Kurmos <quantum.leaf at gmail.com> wrote:
> 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