# public\_dependencies target property?

**URL:** https://discourse.cmake.org/t/public-dependencies-target-property/8024
**Category:** Code
**Created:** [April 30, 2023, 11:04pm UTC](https://discourse.cmake.org/t/public-dependencies-target-property/8024 "2023-04-30T23:04:29Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![marksibly](https://discourse.cmake.org/user_avatar/discourse.cmake.org/marksibly/32/4303_2.png) [@marksibly](https://discourse.cmake.org/u/marksibly)
#### Post date: [April 30, 2023, 11:04pm UTC](https://discourse.cmake.org/t/public-dependencies-target-property/8024/1 "2023-04-30T23:04:29Z")

</div>

Hi,

I’m trying to make sense of this cmake code in the probably vain hope of cleanly it up a bit:

> <https://gist.github.com/cristianadam/ef920342939a89fae3e8a85ca9459b49#file-bundle_static_library-cmake-L32>

The problem is, I can’t find ‘public\_dependencies’ in the cmake docs here:

[https://cmake.org/cmake/help/latest/manual/cmake-properties.7.html#target-properties](https://cmake.org/cmake/help/latest/manual/cmake-properties.7.html#target-properties)

I basically get what it’s doing I just don’t understand the ${\_input\_link\_libraries} parameter. The routine actually mostly works, it just seems to bundle a lot of extra stuff I suspect it doesn’t need to, and suspect the problem may be here-ish.

I’m also a bit confused by the use of LINK\_LIBRARIES/INTERFACE\_LINK\_LIBRARIES stuff a few lines above - why don’t these have a ‘$’ prefix? Do they return _all_ link libraries for all targets? Why are they here then?!?

Bye,  
Mark

---

<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: [May 1, 2023, 3:38pm UTC](https://discourse.cmake.org/t/public-dependencies-target-property/8024/2 "2023-05-01T15:38:00Z")

</div>

> [@marksibly](#):
>
> The problem is, I can’t find ‘public\_dependencies’ in the cmake docs here

`public_dependencies` is the variable to store the result of the property query.

> [@marksibly](#):
>
> I’m also a bit confused by the use of LINK\_LIBRARIES/INTERFACE\_LINK\_LIBRARIES stuff a few lines above - why don’t these have a ‘$’ prefix? Do they return _all_ link libraries for all targets? Why are they here then?!?

These are property names. They’re stored in the `_input_link_libraries` variable so that `get_target_property` gets the “right” one.

> [@marksibly](#):
>
> I basically get what it’s doing I just don’t understand the ${\_input\_link\_libraries} parameter. The routine actually mostly works, it just seems to bundle a lot of extra stuff I suspect it doesn’t need to, and suspect the problem may be here-ish.

It probably should stop when it finds a `SHARED_LIBRARY` and not recurse there as those libraries are already bundled into that library. Other than that, the nested `function` definition is odd…

---

<div class="post-metadata">

### Author: ![marksibly](https://discourse.cmake.org/user_avatar/discourse.cmake.org/marksibly/32/4303_2.png) [@marksibly](https://discourse.cmake.org/u/marksibly)
#### Post date: [May 3, 2023, 2:39am UTC](https://discourse.cmake.org/t/public-dependencies-target-property/8024/3 "2023-05-03T02:39:36Z")

</div>

Aha, so it’s collecting either the LINK\_LIBRARIES or INTERFACE\_LINK\_LIBRARIES property of the given target into the target\_dependencies var - simpler than I thought, must have been having a ‘senior moment’…

Thanks,  
Mark
