How to take advantage of INTERFACE_INCLUDE_DIRECTORIES when building static or OBJECT libraries?

It seems that INTERFACE_INCLUDE_DIRECTORIES is only read and used to populate the include search paths by target_link_libraries. When building a static or OBJECT library, there is no linking step, so it does not make sense to call target_link_libraries. The if my library has calls to another target, even though which as PUBLIC or Interface include directories defined by target_include_directories, I still has to explicitely add its header file paths to the parent target.

For big projects, it’s quite common some subsets are built into static/object libraries first, then how to utilize this INTERFACE_INCLUDE_DIRECTORIES infrastructure when building those static/object libraries?

The name of this command is a bit confusing (it is for historical reasons) but target_link_libraries handles all properties related to compilation and link.

So you can use it on a static target: in this case propertiesINTERFACE_INCLUDE_DIRECTORIES and INTERFACE_COMPILE_* will be propagated to the target for the compile step.

In resume, target_link_libraries is used to declare dependencies between targets for all build aspects.