# How to take advantage of INTERFACE\_INCLUDE\_DIRECTORIES when building static or OBJECT libraries?

**URL:** https://discourse.cmake.org/t/how-to-take-advantage-of-interface-include-directories-when-building-static-or-object-libraries/207
**Category:** Usage
**Created:** [November 15, 2019, 3:29am UTC](https://discourse.cmake.org/t/how-to-take-advantage-of-interface-include-directories-when-building-static-or-object-libraries/207 "2019-11-15T03:29:01Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![oscarh](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/o/aca169/32.png) [@oscarh](https://discourse.cmake.org/u/oscarh)
#### Post date: [November 15, 2019, 3:29am UTC](https://discourse.cmake.org/t/how-to-take-advantage-of-interface-include-directories-when-building-static-or-object-libraries/207/1 "2019-11-15T03:29:01Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![marc.chevrier](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@marc.chevrier](https://discourse.cmake.org/u/marc.chevrier)
#### Post date: [November 15, 2019, 9:11am UTC](https://discourse.cmake.org/t/how-to-take-advantage-of-interface-include-directories-when-building-static-or-object-libraries/207/2 "2019-11-15T09:11:04Z")

</div>

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 properties`INTERFACE_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.
