[CMake] Sub dependencies?
Michael Wild
themiwi at gmail.com
Fri Aug 12 04:57:37 EDT 2011
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 <themiwi at gmail.com
> <mailto:themiwi at 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
More information about the CMake
mailing list