<span style>Yes, target_link_libraries works well, I had problem before because I used find_package(Boost) instead of find_package(Boost COMPONENTS thread), so when I used target_link_libraries( MyProject ${Boost_LIBRARIES} ), it didn't link anything, after I specify the components in find_package, it has no problem.</span> <br>
<br><div class="gmail_quote">On Tue, May 1, 2012 at 11:47 AM, Michael Jackson <span dir="ltr"><<a href="mailto:mike.jackson@bluequartz.net" target="_blank">mike.jackson@bluequartz.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
On May 1, 2012, at 11:37 AM, Mourad Boufarguine wrote:<br>
<br>
><br>
> On Tue, May 1, 2012 at 9:10 AM, Rolf Eike Beer <<a href="mailto:eike@sf-mail.de">eike@sf-mail.de</a>> wrote:<br>
> On Di., 1. Mai. 2012 00:20:58 CEST, Mourad Boufarguine <<a href="mailto:mourad@boufarguine.name">mourad@boufarguine.name</a>> wrote:<br>
><br>
> > Hi,<br>
> ><br>
> > add this :<br>
> ><br>
> > link_directories(${Boost_LIBRARY_DIRS})<br>
> ><br>
> > after the include_directories command.<br>
><br>
> 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.<br>
><br>
> Eike<br>
> --<br>
><br>
><br>
><br>
> 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.<br>
><br>
> #pragma comment (lib, "libboost_xxxx.lib")<br>
><br>
> If you don't add Boost_LIBRARY_DIRS to the link directories, it won't work.<br>
><br>
> Mourad<br>
><br>
<br>
</div></div>Nope. I don't use link_directories at all and I use Boost on windows all the time. I use the "target_link_libraries(...) method and it has NEVER give me any trouble on windows with VS 2005, 2008 and 2010.<br>
<br>
YMMV (but it shouldn't)<br>
---<br>
Mike Jackson <a href="http://www.bluequartz.net" target="_blank">www.bluequartz.net</a><br>
<div class="HOEnZb"><div class="h5"><br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Sophie Wang<div><a href="http://www.sophiehuiwang.com" target="_blank">www.sophiehuiwang.com</a></div><br>