<div dir="ltr">Works like a charm, I knew I was overlooking something small. Thanks, Brad!<div><br></div><div>-Caleb</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 9, 2014 at 2:30 PM, Brad King <span dir="ltr"><<a href="mailto:brad.king@kitware.com" target="_blank">brad.king@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 12/09/2014 12:26 PM, J. Caleb Wherry wrote:<br>
> add_library(ExtLib SHARED IMPORTED)<br>
> set_property(TARGET ExtLib PROPERTY IMPORTED_LOCATION "${CMAKE_BINARY_DIR}/${EXT_LIB_NAME}")<br>
> add_dependencies(ExtLib ExtLibBuild)<br>
<br>
</span>Thanks for the complete/simple example.  The problem is that<br>
the libExtLib.so file built by the external project does not<br>
have DT_SONAME set by the linker.  When a linker is given a<br>
path to a shared library file that has no soname then the path<br>
is copied into the DT_NEEDED field of the consumer since it<br>
has no soname to use for that.<br>
<br>
There are two solutions:<br>
<br>
1. Make sure DT_SONAME gets set properly by the external build system.<br>
<br>
2. Tell CMake that the imported library file has no soname:<br>
<br>
    set_property(TARGET ExtLib PROPERTY IMPORTED_NO_SONAME 1)<br>
<br>
   CMake will then link it via -lExtLib and the linker will not<br>
   store the path to the file in DT_NEEDED but only the file name.<br>
<br>
Either of these should resolve the issue.  Number 1 is cleaner.<br>
<span class="HOEnZb"><font color="#888888"><br>
-Brad<br>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div>J. Caleb Wherry</div><i>Scientific Software Engineer</i><div><br><a href="http://www.calebwherry.com" target="_blank"></a><div><a href="http://www.calebwherry.com" target="_blank">http://www.calebwherry.com</a><br><span><span title="Call with Google Voice"><span title="Call with Google Voice">+1 (615) 708-5651</span></span></span><div><a href="mailto:calebwherry@gmail.com" target="_blank">calebwherry@gmail.com</a></div></div></div></div>
</div>