# How to get final list of linked static libraries ?

**URL:** https://discourse.cmake.org/t/how-to-get-final-list-of-linked-static-libraries/8222
**Category:** Usage
**Created:** [May 28, 2023, 1:18pm UTC](https://discourse.cmake.org/t/how-to-get-final-list-of-linked-static-libraries/8222 "2023-05-28T13:18:22Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![abdelmaged](https://discourse.cmake.org/user_avatar/discourse.cmake.org/abdelmaged/32/3176_2.png) [@abdelmaged](https://discourse.cmake.org/u/abdelmaged)
#### Post date: [May 28, 2023, 1:18pm UTC](https://discourse.cmake.org/t/how-to-get-final-list-of-linked-static-libraries/8222/1 "2023-05-28T13:18:22Z")

</div>

I’d like to get final list of linked static libraries for a shared library target, and do some extra processing on this list.

How can I achieve this ?

I’ve already done some search, but didn’t found concrete answer:

> <https://stackoverflow.com/questions/32756195/recursive-list-of-link-libraries-in-cmake>

> <https://stackoverflow.com/questions/29400312/displaying-a-targets-list-of-linked-libraries-in-cmake>

> <https://stackoverflow.com/questions/75232402/is-it-possible-to-get-a-list-of-linked-libraries-in-cmake-script-as-it-will-be-p>

[https://gitlab.kitware.com/cmake/cmake/-/issues/12435](https://gitlab.kitware.com/cmake/cmake/-/issues/12435)

> [@Enumerate all transitive dependencies of target?](https://discourse.cmake.org/t/enumerate-all-transitive-dependencies-of-target/2523):
>
> Hello! Like some other developers, I need to copy external dependency DLLs to executable’s directory. I’ve checked [this topic](https://discourse.cmake.org/t/copying-dependent-dlls-to-executable-directory/852). Unfortunately, suggested solution doesn’t fit that well First of all, it lists all dependency DLLs, both project, thirdparty and system ones. Thus it requires additional filtering. Second, it takes considerable time due to multiple calls to dumpbin. Third, it doesn’t work as expected if libraries were already copied to runtime output directory. My investigation shows…

---

<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 29, 2023, 1:59pm UTC](https://discourse.cmake.org/t/how-to-get-final-list-of-linked-static-libraries/8222/2 "2023-05-29T13:59:32Z")

</div>

> [@abdelmaged](#):
>
> I’d like to get final list of linked static libraries for a shared library target, and do some extra processing on this list.

At configure time? Not possible. There are some things which cannot be known until generate time, so (in general), generator expressions are just not resolvable at this time. If you can wait until _build_ time, [`<LANG>_LINKER_LAUNCHER`](https://cmake.org/cmake/help/latest/prop_tgt/LANG_LINKER_LAUNCHER.html) is the most reliable way to get it as you get access to the full command line.

---

<div class="post-metadata">

### Author: ![abdelmaged](https://discourse.cmake.org/user_avatar/discourse.cmake.org/abdelmaged/32/3176_2.png) [@abdelmaged](https://discourse.cmake.org/u/abdelmaged)
#### Post date: [May 29, 2023, 6:16pm UTC](https://discourse.cmake.org/t/how-to-get-final-list-of-linked-static-libraries/8222/3 "2023-05-29T18:16:04Z")

</div>

I was hoping to get it in _Generate Time_, but build time will do for me.  
Thanks.
