[CMake] Help Please-Link Library

Eric Noulard eric.noulard at gmail.com
Mon Jul 16 19:52:35 EDT 2007


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



-- 
Erk


More information about the CMake mailing list