# \`target\_link\_libraries\` not propagating include paths to dependent targets

**URL:** https://discourse.cmake.org/t/target-link-libraries-not-propagating-include-paths-to-dependent-targets/5162
**Category:** Code
**Created:** [March 4, 2022, 8:16pm UTC](https://discourse.cmake.org/t/target-link-libraries-not-propagating-include-paths-to-dependent-targets/5162 "2022-03-04T20:16:28Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![theonemcdonald](https://discourse.cmake.org/user_avatar/discourse.cmake.org/theonemcdonald/32/2245_2.png) [@theonemcdonald](https://discourse.cmake.org/u/theonemcdonald)
#### Post date: [March 4, 2022, 8:16pm UTC](https://discourse.cmake.org/t/target-link-libraries-not-propagating-include-paths-to-dependent-targets/5162/1 "2022-03-04T20:16:28Z")

</div>

Hi,

I’m new to CMake. I’ve been listening to and watching lots of CMake talks, learning about “modern” cmake, etc. I understand that I should be thinking in terms of targets. Got it.

Maybe I’m misunderstanding something, but I’m having an issue with dependents not inheriting public include properties from their dependencies.

For instance, I have a project that builds a shared library (MyLib) and three test applications (AppA, \*B, and \*C). So I have something like this:

```auto
add_library(MyLib SHARED my_lib.c)
target_include_directories(MyLib PUBLIC "/something/something/path")

add_exectuable(AppA app_a.c)
target_link_libraries(AppA PUBLIC MyLib)

```

Should the include directories from MyLib marked `PUBLIC` be automatically included when building AppA because of the `target_link_libraries(AppA PUBLIC MyLib)` ? If so, I’m not seeing that behavior. When I examine both `INCLUDE_DIRECTORIES` and `INTERFACE_INCLUDE_DIRECTORIES` for `AppA` target, both properties are empty, even though there is a dependency established via the call to `target_link_libraries`

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [March 4, 2022, 8:43pm UTC](https://discourse.cmake.org/t/target-link-libraries-not-propagating-include-paths-to-dependent-targets/5162/2 "2022-03-04T20:43:56Z")

</div>

> [@theonemcdonald](#):
>
> When I examine both `INCLUDE_DIRECTORIES` and `INTERFACE_INCLUDE_DIRECTORIES` for `AppA` target, both properties are empty, even though there is a dependency established via the call to `target_link_libraries`

The properties don’t get “updated” until generate time, so looking up the properties at configure time doesn’t really tell you much. You’ll need something like `$<TARGET_PROPERTY:MyApp,INTERFACE_INCLUDE_DIRECTORIES>` to get this information.

---

<div class="post-metadata">

### Author: ![theonemcdonald](https://discourse.cmake.org/user_avatar/discourse.cmake.org/theonemcdonald/32/2245_2.png) [@theonemcdonald](https://discourse.cmake.org/u/theonemcdonald)
#### Post date: [March 4, 2022, 8:58pm UTC](https://discourse.cmake.org/t/target-link-libraries-not-propagating-include-paths-to-dependent-targets/5162/3 "2022-03-04T20:58:36Z")

</div>

Awesome, thanks. That fills in a piece of the puzzle conceptually. Much appreciated.

That was enough to get me looking deeper and I found the issue ( and turning on verbose makefiles 🙂 )
