[cmake-developers] Convention driven CMAKE_USE_PACKAGE macro

Brad King brad.king at kitware.com
Fri Feb 24 14:00:52 EST 2012


On 2/24/2012 1:56 PM, Clinton Stimpson wrote:
> What about a more generic approach like the following?
>
> add_library(foo IMPORTED ...)
> set_target_properties(foo PROPERTIES
>        DEPENDENT_COMPILE_DEFINITIONS "FOO_DEFINE"
>        DEPENDENT_INCLUDE_DIRECTORIES "/path/to/foo/include")
>
> add_executable(bar ...)
> target_link_libraries(foo bar)
>
> And that could automatically add -DFOO_DEFINE and -I/path/to/foo/include to
> the bar executable.
> So basically any DEPENDENT_<property>  can be pushed to<property>  on the other
> target.

Nice.  This is exactly the kind of interface I had in mind for the
"usage requirements" approach Alex and I were discussing elsewhere
in this thread.  We will have to think about how to define transitive
properties of these requirements though.

-Brad



More information about the cmake-developers mailing list