<div dir="ltr">On Tue, Sep 9, 2008 at 12:42 PM, Armand Filippi (Temp) <span dir="ltr"><<a href="mailto:Armand.Filippi@autodesk.com">Armand.Filippi@autodesk.com</a>></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> </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> </p>
<p>For MSVC, I would like it to end up in the
Librarian>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> </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> </p>
<p>Apparently, using the Cmake command: target_link_libraries(<my
lib A> <my lib B>) with Cmake 2.6.0 patch0 does not produce this
result (nothing in the additional dependencies field in MSVC)</p>
<p> </p>
<p>Is that supported by Cmake ?</p></div></div></blockquote>I don't think they've added built-in support to do what you want to do in CMake because it'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't figure out a way to do what you want to do with CMake's MSVC generator. It looks like this may be a coding oversight in CMake. A suggested fix would be for CMake to allow SET_TARGET_PROPERTIES(... LINK_FLAGS) to work on Visual Studio static libraries. Right now this doesn't appear to work, at least with specifying additional ".lib" files to link against.<br>
<br>Here's a test example for this if someone wants to have a look. I wasn'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>