why?<div><br></div><div>I've invoked:</div><div><br></div><div>find_package(liba REQUIRED)</div><div><br></div><div>not:</div><div><br></div><div>find_package(libpng REQUIRED)</div><div><br></div><div>My application has no knowledge about libpng, or libjpg or whatever the heck else liba uses to load images.</div>
<div><br></div><div>~</div><div>Doug.<br><br><div class="gmail_quote">On Fri, Aug 12, 2011 at 3:11 PM, Andreas Pakulat <span dir="ltr"><<a href="mailto:apaku@gmx.de">apaku@gmx.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On 12.08.11 11:23:46, Doug wrote:<br>
> That works if it's all in a single project, but it's not.<br>
><br>
> I totally understand you can do this:<br>
><br>
> add_library(foo)<br>
> target_link_library(foo bar)<br>
> add_executable(exec)<br>
> target_link_library(exec foo)<br>
><br>
> If you have _this_ structure:<br>
><br>
> .../liba/CMakeLists.txt<br>
> ....<br>
><br>
> .../blah/libb/CMakeLists.txt<br>
> ....<br>
><br>
> ..../some/other/path/exec/CMakeLists.txt<br>
><br>
> Then in exec you can you use find_package(libb REQUIRED)<br>
><br>
> However, when I compile it I still get dependency resolution errors on liba<br>
> (libpng in my case).<br>
><br>
> I'm guessing thats because to resolve libb all you get a include path and a<br>
> library path; find package has no way to load the CMakeLists.txt in libb/<br>
> and parse it, add the dependency to liba.<br>
><br>
> Seems like there should be a way to do this though.<br>
><br>
> Am I wrong?<br>
><br>
> Should the values in libb's CMakeLists.txt be propagating through?<br>
<br>
</div>No. Whats supposed to happen is that find_package will give you a<br>
cmake-variable containing the absolute path to the png-library. And that<br>
variable you should use in your target_link_libraries call:<br>
<br>
target_link_libraries( exec ${PNG_LIBRARY} )<br>
<br>
If you look at the cmake manual for target_link_libraries you'll notice<br>
that the 'target' in its name refers to its first argument. The second<br>
and all following arguments are basically just link-flags for the<br>
linker.<br>
<font color="#888888"><br>
Andreas<br>
</font><div><div></div><div class="h5"><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>
</div></div></blockquote></div><br></div>