<div dir="ltr"><div dir="ltr"><div>Hi Dustyn,</div><div><br></div><div>ELF platforms link against .so files, but Windows links against import libraries (.lib files) assocaited with DLLs. Does the target 'bar' have the IMPORTED_IMPLIB property set up correctly? (See <a href="https://cmake.org/cmake/help/latest/prop_tgt/IMPORTED_IMPLIB.html">https://cmake.org/cmake/help/latest/prop_tgt/IMPORTED_IMPLIB.html</a> )</div><div><br></div><div>Petr<br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 16 Apr 2019 at 21:37, Dustyn Blasig <<a href="mailto:dustyn@blasig.us">dustyn@blasig.us</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Hi All,<br><div><br></div><div>I'm trying to debug an issues where an imported shared library is showing up in the linker command as not found, but within the CMake generation the target seems to exist.</div><div><br></div></div><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div><div><font face="monospace, monospace"># CMakeLists.txt ####################</font></div></div><div><div><font face="monospace, monospace"><br></font></div></div><div><div><font face="monospace, monospace">include(bar.cmake)</font></div></div><div><div><font face="monospace, monospace"><br></font></div></div><div><div><font face="monospace, monospace">add_library(foo SHARED)</font></div></div><div><div><font face="monospace, monospace"><br></font></div></div><div><div><font face="monospace, monospace">if(TARGET bar)</font></div></div><div><div><font face="monospace, monospace"> target_link_libraries(foo PUBLIC bar)</font></div></div><div><div><font face="monospace, monospace">endif()</font></div></div><div><div><font face="monospace, monospace"><br></font></div></div><div><div><font face="monospace, monospace"># bar.cmake #######################</font></div></div><div><div><font face="monospace, monospace"><br></font></div></div><div><div><font face="monospace, monospace">add_library(bar SHARED IMPORTED)</font></div></div><div><div><font face="monospace, monospace"><br></font></div></div><div><div><font face="monospace, monospace">...</font></div></div></blockquote><div dir="ltr"><div><br></div><div>On Linux, the link command contains the correct <b>-L<bar path></b> and <b>-lbar</b> options. However, on Windows (Visual Studio) the linker command has "bar-NOTFOUND" instead of bar.lib as it should, even though bar should only be added as a dependency *if* it exists. </div><div><br></div><div>How can I debug why this would happen? Is there a way to have CMake dump more information about that target?</div><div><br></div><div>Thanks!</div></div></div>
-- <br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://cmake.org/mailman/listinfo/cmake" rel="noreferrer" target="_blank">https://cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div>