[CMake] Fwd: TARGET_LINK_LIBRARIES not working for MSVC

Avanindra Singh avanindra.singh at gmail.com
Sat Jan 8 10:17:51 EST 2011


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.

Regards
Avanindra

On Sat, Jan 8, 2011 at 8:15 PM, Eric Noulard <eric.noulard at gmail.com> wrote:

> > Hi john,
> >
> > Thanks for the reply.Multiple TARGET_LINK_LIBRARIES
> >  did not give any configuration error. Though I removed the WIN32 If
> > block, but I am still getting the same linking errors.
> > TARGET_LINK_LIBRARIES(hybridnccsurfacecoloring bundler imagelib matrix
> mathlib
> >                       5point libsba  libepnp
> >                       sfm libDescriptors f2c  minpack lapack ann getopt
> jpeg)
> > #if(WIN32)
> > #TARGET_LINK_LIBRARIES(hybridnccsurfacecoloring getopt jpeg)
> > #endif(WIN32)
> > I am absolutely clueless why the linker is not generated in the msvc
> > project. Any idea what could be the possible reason for it?...
>
> May be you can a try a simpler executable target which only requires
> one lib then try this example both on Linux and MSVC.
>
> The idea is, scale down your problem to something more easy to
> understand for us.
> In the current case we don't know if ALL your target are failing to
> link or some of them
> which symbols are missing etc...
>
> Which version of CMake are you using (On Linux and on Windows)?
> Did you try with Code::Blocks  on windows?
>
> Are the find_package statement successful on Windows too?
> e.g. does;
> find_package(ImageMagick COMPONENTS Magick++ MagickCore)
> leads to ImageMagick_FOUND or not?
>
> --
> Erk
> Membre de l'April - « promouvoir et défendre le logiciel libre » -
> http://www.april.org
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110108/3e8962c0/attachment.htm>


More information about the CMake mailing list