Add the sub dependencies that library A has with target_link_libraries():<br><br> target_link_libraries(A png)<br><br>--<br>Glenn<br><br><div class="gmail_quote">On 11 August 2011 10:02, Doug <span dir="ltr"><<a href="mailto:douglas.linder@gmail.com">douglas.linder@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hrm... this seems like something cmake should be able to do, but I don't know how to make it work.<div><br></div><div>
If I have library A, that depends on a library and an executable project that depends on library A, how can the executable project resolve the sub dependencies from A?</div>
<div><br></div><div>Specifically libpng in my case:</div><div><br></div><div>I have a library that depends on libpng.</div><div><br></div><div>I run cmake to build the library no problem.</div><div><br></div><div>Then I try to compile a program that depends on the library and get a heap of errors like:</div>
<div><br></div><div><div> undefined reference to `png_set_read_fn'</div></div><div> etc. etc.</div><div><br></div><div>Presumably this is something about how I depend on the library? I'm using the LibFindMacros, so my cmake module looks like this for the library:</div>
<div><br></div><div><div>include(LibFindMacros)</div><div><br></div><div>find_path(LIBNW_INCLUDE_DIR NAMES nw.h PATHS ${LIBNW_PKGCONF_INCLUDE_DIRS})</div><div><br></div><div>find_library(LIBNW_LIBRARY NAMES nw PATHS ${LIBNW_PKGCONF_LIBRARY_DIRS})</div>
<div><br></div><div>set(LIBNW_PROCESS_INCLUDES LIBNW_INCLUDE_DIR)</div><div>set(LIBNW_PROCESS_LIBS LIBNW_LIBRARY LIBNW_LIBRARIES)</div><div><br></div><div>libfind_process(LIBNW)</div></div><div><br></div><div> I know I can use ADD_SUBDIRECTORY to include stuff for a sub dir, but that isn't really appropriate in this case.</div>
<div><br></div><div>~</div><div>Doug.</div>
<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>