<span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">How can I achieve that _without_ editing my own cmake file?<div><br></div>
<div>What if a swap in a different library for my executable that is abi compatible but uses a different implemented to load images? </div><div><br></div><div>I&#39;m not talking hypotheticals here: I literally have two versions of the library that use slightly different versions of libpng (one for desktop and one for android) and it&#39;s extremely inconvenient to be messing around with my cmake file every time I change my build target.</div>
<div><br></div><div>Sure I can do a giant IF(TARGET MATCHES &quot;Android&quot;) ... ENDIF, which I guess is what I will do for now, but it seems like a poor solution.</div><div><br></div><div>Edit: woops; ment that to go to the list.</div>
<div><br></div><div>~</div><div>Doug.</div><div><br></div></span><div class="gmail_quote">On Thu, Aug 11, 2011 at 7:39 PM, Glenn Coombs <span dir="ltr">&lt;<a href="mailto:glenn.coombs@gmail.com">glenn.coombs@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">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"><div><div></div><div class="h5">On 11 August 2011 10:02, Doug <span dir="ltr">&lt;<a href="mailto:douglas.linder@gmail.com" target="_blank">douglas.linder@gmail.com</a>&gt;</span> wrote:<br>

</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5">Hrm... this seems like something cmake should be able to do, but I don&#39;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&#39;</div></div><div> etc. etc.</div><div><br></div><div>Presumably this is something about how I depend on the library? I&#39;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&#39;t really appropriate in this case.</div>


<div><br></div><div>~</div><div>Doug.</div>
<br></div></div>_______________________________________________<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>
</blockquote></div><br>