<div dir="ltr">On Tue, Sep 9, 2008 at 12:42 PM, Armand Filippi (Temp) <span dir="ltr">&lt;<a href="mailto:Armand.Filippi@autodesk.com">Armand.Filippi@autodesk.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">









<div link="blue" vlink="purple" lang="EN-US">

<div>

<p>Hi all,</p>

<p>&nbsp;</p>

<p>I am trying to _<i>include</i>_ an externally built library
B in a static lib A that I'm building with Cmake.</p>

<p>&nbsp;</p>

<p>For MSVC, I would like it to end up in the
Librarian&gt;Additional Dependencies (and have its path in the Additional Library
Directories). Also, this would add some /LIBPATH: and the library names at the
end of the linker command.</p>

<p>&nbsp;</p>

<p>For Linux ld, the equivalent result would be to have the B
library appended to the linker command, with the â€“whole-archive
parameter.</p>

<p>&nbsp;</p>

<p>Apparently, using the Cmake command: target_link_libraries(&lt;my
lib A&gt; &lt;my lib B&gt;) with Cmake 2.6.0 patch0 does not produce this
result (nothing in the additional dependencies field in MSVC)</p>

<p>&nbsp;</p>

<p>Is that supported by Cmake ?</p></div></div></blockquote>I don&#39;t think they&#39;ve added built-in support to do what you want to do in CMake because it&#39;s not portable everywhere.<br><br>With GNU ld on Linux you can simply pass any flags you might need to TARGET_LINK_LIBRARIES to grab the libraries you need:<br>
<a href="http://www.mail-archive.com/cmake@cmake.org/msg01890.html">http://www.mail-archive.com/cmake@cmake.org/msg01890.html</a><br><div><br><br>I couldn&#39;t figure out a way to do what you want to do with CMake&#39;s MSVC generator.&nbsp; It looks like this may be a coding oversight in CMake.&nbsp; A suggested fix would be for CMake to allow SET_TARGET_PROPERTIES(... LINK_FLAGS) to work on Visual Studio static libraries.&nbsp; Right now this doesn&#39;t appear to work, at least with specifying additional &quot;.lib&quot; files to link against.<br>
<br>Here&#39;s a test example for this if someone wants to have a look.&nbsp; I wasn&#39;t sure that MSVC even supported this use case until I modified the Visual Studio project manually and verified that it does work.<br><br>
</div></div>-- <br>Philip Lowman<br>
</div>