[CMake] [Boost-users] link error in Visual Studio when using boost from CMake

Mourad Boufarguine mourad at boufarguine.name
Tue May 1 11:37:19 EDT 2012


On Tue, May 1, 2012 at 9:10 AM, Rolf Eike Beer <eike at sf-mail.de> wrote:

> On Di.,   1. Mai. 2012 00:20:58 CEST, Mourad Boufarguine <
> mourad at boufarguine.name> wrote:
>
> > Hi,
> >
> > add this :
> >
> > link_directories(${Boost_LIBRARY_DIRS})
> >
> > after the include_directories command.
>
> No, please don't. The target_link_libraries command is what you really
> want. Please stop advertising link_directories, it's usage is almost
> certainly wrong and while it sometimes seems to solve your problem it
> usually just creates another one.
>
> Eike
> --
>
>
>
Unless you disable Boost auto-linking, i'm afraid it's the only option.
Boost autolinking is enabled by default for Visual Studio. In this case,
Boost headers have pragmas to link to Boost libs.

#pragma comment (lib, "libboost_xxxx.lib")

If you don't add  Boost_LIBRARY_DIRS  to the link directories, it won't
work.

Mourad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120501/562a0d43/attachment-0001.htm>


More information about the CMake mailing list