[CMake] Help Please-Link Library

Janny Dong janny.dong at gmail.com
Tue Jul 17 16:27:13 EDT 2007


Thanks Eric and Bill. It works.



On 7/16/07, Bill Hoffman <bill.hoffman at kitware.com> wrote:
>
> Eric Noulard wrote:
> > 2007/7/16, Janny Dong <janny.dong at gmail.com>:
> >> Hi all,
> >>
> >> I am using Cmake to build MS Visual C++ program because I am using
> >> VTK. I'd
> >> like to link to another thirty-party library in my project. The
> >> library is
> >> already installed on my machine by running the executable setup file
> >> . In a
> >> project not built by Cmake, all I need to do is just modify the Project
> >> Properties: add mylibrary.lib to Linker->Input->Additional
> >> Dependencies. How
> >> can I do this in a project built by Cmake? I cannot add it directly
> >> in the
> >> Project Properties page because it complains.
> >>
> >> I am new to Cmake and I got lost in the Cmake commands. Any help
> >> would be
> >> appreciated!
> >
> > You should add a:
> >
> > TARGET_LINK_LIBRARY to your CMakeLists.txt
> > see the documentation of the macro.
> >
> > in http://www.cmake.org/HTML/Documentation.html
> >
> > If your lib is not in the lib search path then you need to add the
> > appropriate
> > PATH using the LINK_DIRECTORIES macro
> >
> It is much better to add the full path to the library, and use
> FIND_LIBRARY.
>
> -Bill
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20070717/a365d371/attachment.html


More information about the CMake mailing list