[CMake] linking to .so's

Philip Lowman philip at yhbt.com
Thu May 22 08:37:05 EDT 2008


On Wed, May 21, 2008 at 8:45 AM, Steven Van Ingelgem <steven at vaningelgem.be>
wrote:

> I have a question about how to link (via CMake) to specific .so's.
>
> I know I need to use target_link_libraries. But what happens then is
> that the so is linked against the directory where it's in.
> Is there a possibility (i know rpath does exist, but I don't know
> exactly how to use it) to have the .so's loaded from the local
> directory before it starts looking in the default library directories?


Steven,

Read the documentation for the find_library() command the output of which
you should use in target_link_libraries().  Take note of the
CMAKE_LIBRARY_PATH and CMAKE_PREFIX_PATH (2.6.0) options.  Using these it
should be possible to make CMake find libraries in paths you desire before
it checks the default system paths.  You can also use NO_DEFAULT_PATH and
specify the paths directly to the find_library() command.

http://www.cmake.org/HTML/Documentation.html

-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080522/5d0ed024/attachment.htm>


More information about the CMake mailing list