<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&#39;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">&lt;<a href="mailto:mike.jackson@bluequartz.net" target="_blank">mike.jackson@bluequartz.net</a>&gt;</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>
&gt;<br>
&gt; On Tue, May 1, 2012 at 9:10 AM, Rolf Eike Beer &lt;<a href="mailto:eike@sf-mail.de">eike@sf-mail.de</a>&gt; wrote:<br>
&gt; On Di.,   1. Mai. 2012 00:20:58 CEST, Mourad Boufarguine &lt;<a href="mailto:mourad@boufarguine.name">mourad@boufarguine.name</a>&gt; wrote:<br>
&gt;<br>
&gt; &gt; Hi,<br>
&gt; &gt;<br>
&gt; &gt; add this :<br>
&gt; &gt;<br>
&gt; &gt; link_directories(${Boost_LIBRARY_DIRS})<br>
&gt; &gt;<br>
&gt; &gt; after the include_directories command.<br>
&gt;<br>
&gt; No, please don&#39;t. The target_link_libraries command is what you really want. Please stop advertising link_directories, it&#39;s usage is almost certainly wrong and while it sometimes seems to solve your problem it usually just creates another one.<br>

&gt;<br>
&gt; Eike<br>
&gt; --<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Unless you disable Boost auto-linking, i&#39;m afraid it&#39;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>
&gt;<br>
&gt; #pragma comment (lib, &quot;libboost_xxxx.lib&quot;)<br>
&gt;<br>
&gt; If you don&#39;t add  Boost_LIBRARY_DIRS  to the link directories, it won&#39;t work.<br>
&gt;<br>
&gt; Mourad<br>
&gt;<br>
<br>
</div></div>Nope. I don&#39;t use link_directories at all and I use Boost on windows all the time. I use the &quot;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&#39;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>