why?

I've invoked:

find_package(liba REQUIRED)

not:

find_package(libpng REQUIRED)

My application has no knowledge about libpng, or libjpg or whatever the heck
else liba uses to load images.

~
Doug.

On Fri, Aug 12, 2011 at 3:11 PM, Andreas Pakulat <ap...@gmx.de> wrote:

> On 12.08.11 11:23:46, Doug wrote:
> > That works if it's all in a single project, but it's not.
> >
> > I totally understand you can do this:
> >
> > add_library(foo)
> > target_link_library(foo bar)
> > add_executable(exec)
> > target_link_library(exec foo)
> >
> > If you have _this_ structure:
> >
> > .../liba/CMakeLists.txt
> > ....
> >
> > .../blah/libb/CMakeLists.txt
> > ....
> >
> > ..../some/other/path/exec/CMakeLists.txt
> >
> > Then in exec you can you use find_package(libb REQUIRED)
> >
> > However, when I compile it I still get dependency resolution errors on
> liba
> > (libpng in my case).
> >
> > I'm guessing thats because to resolve libb all you get a include path and
> a
> > library path; find package has no way to load the CMakeLists.txt in libb/
> > and parse it, add the dependency to liba.
> >
> > Seems like there should be a way to do this though.
> >
> > Am I wrong?
> >
> > Should the values in libb's CMakeLists.txt be propagating through?
>
> No. Whats supposed to happen is that find_package will give you a
> cmake-variable containing the absolute path to the png-library. And that
> variable you should use in your target_link_libraries call:
>
> target_link_libraries( exec ${PNG_LIBRARY} )
>
> If you look at the cmake manual for target_link_libraries you'll notice
> that the 'target' in its name refers to its first argument. The second
> and all following arguments are basically just link-flags for the
> linker.
>
> Andreas
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to