<div dir="ltr"><div><div><div><div><div><div><div><div><div>Hi everyone,<br><br></div>Reading answer from leif and andreas, leads me to advance a bit. <br><br></div><div>To my opinion writing target_link_libraries(exe1 libB libC) would certainly works (but I m not able to test it at the moment).<br>
</div><div><br>But my problem should be explain the more tricky way :<br></div>libB depends on libC function implementation but is a dependency of libD :<br><br></div>I got Exe depends upon libD which use libB which use libC. libC uses function defined in libB.<br>
<br></div>If I try Leif and Andreas idea : TARGET_LINK_LIBRARIES(Exe1 libD libC1)<br></div>This line leads to output this gcc link line (schematically) :<br><br></div>gcc -o exe1 libD libC1 libB &lt;==== Dependency of libD appears after all other &quot;executable direct&quot; dependencies<br>
<br></div>This does not work since libB depends on libC. The right gcc line would be :<br><br></div>gcc -o exe1 libD libC1 libB libC1 libB &lt;==== I know this repetition of libB libC1 looks a bit stupid but it does not work else ...<br>
<br></div>These last line of gcc is what is done when setting all dependency. (TARGET_LINK_LIBRARIES(libB libC1) and TARGET_LINK_LIBRARIES(libC1 libB) but again the whole solution would require to build twice libB (and therefore libD and etc etc) to build with two different flavor of libC (libC1 and libC2).<br>
<div><div><div><div><div><div><div><div><div><div><br></div><div>Thks for your help ...<br>Pierre<br></div><div><br></div><div><br><br></div></div></div></div></div></div></div></div></div></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Mon, Feb 25, 2013 at 2:14 PM, Andreas Stahl <span dir="ltr">&lt;<a href="mailto:andreas.stahl@tu-dresden.de" target="_blank">andreas.stahl@tu-dresden.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello Pierre,<br>
<br>
my knowledge concerning the linking process is rather limited, but wouldn&#39;t that mean you don&#39;t need to inter-link the libraries at all, when the symbols are resolved at link-time with the executable?<br>
add_executable(ex1 libB libC1 libC2) should suffice then.<br>
<br>
Best regards,<br>
Andreas<br>
<br>
<br>
Am 25.02.2013 um 13:47 schrieb Pierre Mallard:<br>
<div class="HOEnZb"><div class="h5"><br>
&gt; Well it is indeed possible and it works... Note that static libraries &#39;s object files are built with unresolved symbols. Final resolution is performed when building executable<br>
&gt; Therefore libB can compile without libC and conversely ...<br>
&gt; Anyone else ?<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Mon, Feb 25, 2013 at 12:23 PM, Ansis Māliņš &lt;<a href="mailto:ansis.malins@gmail.com">ansis.malins@gmail.com</a>&gt; wrote:<br>
&gt; &gt;libB depends on libC and libC depends on libB.<br>
&gt; How is that even possible? You compile B and it fails because there&#39;s no C yet. You compile C and it fails because there&#39;s no B yet.<br>
&gt;<br>
</div></div><div class="HOEnZb"><div class="h5">&gt; --<br>
&gt;<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; 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>
&gt;<br>
&gt; 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>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
<br>
</div></div><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></blockquote></div><br></div>