[CMake] Fwd: TARGET_LINK_LIBRARIES not working for MSVC

John Drescher drescherjm at gmail.com
Sat Jan 8 10:21:13 EST 2011


On Sat, Jan 8, 2011 at 10:17 AM, Avanindra Singh
<avanindra.singh at gmail.com> wrote:
> Hi Eric,
> Thanks for the reply. It was very useful. I incorporated the changes you
> mentioned. I removed all the link_libraries macros
> from the projects. Also I changed camke_minimum_version to 2.6 . I have
> CMake 2.8 in both windows as well as Linux. Though
> I am still getting the same errors.I would strip the project down to one or
> two lib and I would get back with the results.
> Though one point I would like to mention, the linker problem is coming for
> all the libraries in project added through
> ADD_LIBRARY macro. While the linker is produced correct to target added with
> ADD_EXECUTABLES. I had only one
> executable in my whole project and it is in the root CMakeLists.txt. When I
> remove the main.cpp from ADD_EXECUTABLES
> and replace it with ADD_LIBRARY, I get linker error for root too, again no
> linker is generated for ADD_LIBRARY target.
> For the find_package macro as you mentioned, it worked for BOOST and OPenCV
> but did not find ImageMagick, so I hardcoded
> the includes and Libraries.

You can do that for testing but you should really never hardcode
paths. Just enter the correct path into cmake-gui, configure and
generate.

John


More information about the CMake mailing list