[cmake-developers] transitive -I and -D usage requirements (was: Policy for INTERFACE_LINK_LIBRARIES)

Brad King brad.king at kitware.com
Wed Dec 12 10:48:50 EST 2012


On 12/09/2012 08:48 AM, Stephen Kelly wrote:
> I think the 'Setting include directories via target_link_libraries() ?' 
> thread needs to be concluded first (with reasoning), as that affects 
> everything else.

While thinking about my next response to that discussion I read your
wip-target-interface in more detail to look at handling of include dirs
and compile defs.  Can you explain what the commit

 "Handle INTERFACE properties transitively for includes and defines"

is doing please?  What is "transitive" in that implementation?
Later in the commit

 "Add includes and compile definitions with target_link_libraries"

I see propagation of INTERFACE_INCLUDE_DIRECTORIES into the implementation
INCLUDE_DIRECTORIES of the target.  However, it is not transitive through
the link interface closure.

Since the link interface closure isn't known until generate time when the
full link interface generator expressions can be evaluated, I do not think
we can compute the full include directories or compile definitions until
then either.  When a dependency is put in the link interface of a shared
library that means that clients including headers from the shared library
may get headers from the dependency too.  Otherwise there is no way the
client could get direct references to symbols from the dependency and it
would not need to be in the link interface.  Once a dependency is in the
link interface, even transitively, clients need the -I and -D flags for
it.  Therefore we need to get them from the link interface closure, and
it cannot be done until generate time.

Thoughts?
-Brad


P.S. I'm not asking you to update the implementation in your branch yet,
just to comment on my observations above.



More information about the cmake-developers mailing list