[CMake] adding a link directory

Rolf Eike Beer eike at sf-mail.de
Sun May 8 10:22:12 EDT 2011


Am Sonntag, 8. Mai 2011, 14:25:34 schrieb Liam Kurmos:
> Hi,
> 
> I've been using cmake to build vtk projects for some time, but i've
> only really learnt the minimum i need.
> 
> Now i want to link against a single shared library.
> 
> until now i've added libraries with
> eg.
> TARGET_LINK_LIBRARIES(testOVAS vtkWidgets vtkRendering vtkHybrid vnl
> tourtre)
> 
> which has worked as i have lines like
> FIND_PACKAGE(VXL)
> FIND_PACKAGE(VTK REQUIRED)
> 
> however it wont work for tourtre as the linker cant find it.
> 
> i think one solution to add tourtre to my project might be to create a
> FindTourtre.cmake but this process looks quite in depth and i only
> wish to link a single shared library.
> 
> from the documentation i think it should be possible to do:
> 
> LINK_DIRECTORIES( ${LINK_DIRECTORIES} /absPath/libtourtre/)

Don't use LINK_DIRECTORIES.

TARGET_LINK_LIBRARIES(testOVAS /absPath/libtourtre/libtourtre.so)

Or even better

FIND_LIBRARY(TOURTRE_LIBRARY tourtre /absPath/libtourtre)
TARGET_LINK_LIBRARIES(testOVAS ${TOURTRE_LIBRARY})

Which is half of what you need for a FindTourtre.cmake.

Eike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110508/ff500bf8/attachment.pgp>


More information about the CMake mailing list