[cmake-developers] INTERFACE_INCLUDE_DIRECTORIES on STATIC libs

Brad King brad.king at kitware.com
Fri Feb 8 13:34:47 EST 2013


On 02/08/2013 01:25 PM, Stephen Kelly wrote:
> Brad King wrote:
> 
>> It does make sense to publish INTERFACE_INCLUDE_DIRECTORIES and
>> INTERFACE_COMPILE_DEFINITIONS on object library targets, but we
>> do not need to chain to them automatically. 
> 
> I tried writing a unit test for this, but couldn't see why this would be 
> useful. Consumers of an object library don't use headers from it, do they? 
> Why then would include directories or compile definitions for them be 
> useful?

The motivating use case for object libraries is to have several
object libraries, typically each in its own subdirectory, that
have their own private implementation's include directories,
compile definitions, flags, etc. and then they get combined
into one library or executable at the end.  That final target
may have its own sources which include headers for interfaces
from the individual object libraries.  Those symbols will be
resolved simply by having the objects themselves linked in,
but otherwise it is not much different from a regular library.

-Brad



More information about the cmake-developers mailing list