On Sat 13 Aug 2011 03:55:06 AM CEST, Doug wrote: > I see. > > I've tried this approach and I get the error: > -- Found LIBPNG > CMake Error at CMakeLists.txt:49 (export): > export given target "/usr/lib/libpng.so" which is not built by this > project. > > > -- Configuring incomplete, errors occurred! > > ~ > Doug. > > On Fri, Aug 12, 2011 at 4:57 PM, Michael Wild <them...@gmail.com > <mailto:them...@gmail.com>> wrote: > > On Fri 12 Aug 2011 10:49:45 AM CEST, Doug wrote: > > I'm sorry if I'm being dumb here, but I fail to see how that helps. > > > > That example is one where foobar depends explicitly on foo and bar. > > > > What if foo depends on bar2? > > > > How do I inherit that dependency from foo in foobar? > > > > _that's_ what I'm looking for. > > > > (If that example somehow explains that, I'm sorry, I can't see it. Can > > you point to a specific point in the page?) > > > > ~ > > Doug. > > > > On Fri, Aug 12, 2011 at 2:34 PM, Michael Wild <them...@gmail.com > <mailto:them...@gmail.com> > > <mailto:them...@gmail.com <mailto:them...@gmail.com>>> wrote: > > > > If the projects are independent, you might want to take a look > at this > > Wiki page: > > > > http://www.cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file. > > > > HTH > > > > Michael > > > > And that is what the example is *about*. The FooBar project *exports* > its targets, along with their dependencies, so that when other projects > do find_package(FooBar), they will be able to link against the foo > library without having to know any of the dependencies of it. E.g. the > project "hello" might look like this: > > project(hello) > find_package(FooBar REQUIRED) > include_directories(${FOOBAR_INCLUDE_DIRS}) > add_executable(hello hello.c) > target_link_libraries(hello ${FOOBAR_LIBRARIES}) > > > Michael
Did you do something like this? export(TARGETS /usr/lib/libpng.so) That would be wrong... You do it like this find_package(PNG REQUIRED) add_library(foo SHARED foo.c) target_link_libraries(foo ${PNG_LIBRARIES}) install(TARGETS foo EXPORT FooLibraryDepends RUNTIME DESTINATION bin LIBRARY DESTINATION lib) export(TARGETS foo FILE "${PROJECT_BINARY_DIR}/FooLibraryDepends.cmake") Michael _______________________________________________ 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