# Is there are way to read dependencies of cmake built library?

**URL:** https://discourse.cmake.org/t/is-there-are-way-to-read-dependencies-of-cmake-built-library/7592
**Category:** Code
**Created:** [March 3, 2023, 6:24am UTC](https://discourse.cmake.org/t/is-there-are-way-to-read-dependencies-of-cmake-built-library/7592 "2023-03-03T06:24:15Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![hihig2001](https://discourse.cmake.org/user_avatar/discourse.cmake.org/hihig2001/32/2815_2.png) [@hihig2001](https://discourse.cmake.org/u/hihig2001)
#### Post date: [March 3, 2023, 6:24am UTC](https://discourse.cmake.org/t/is-there-are-way-to-read-dependencies-of-cmake-built-library/7592/1 "2023-03-03T06:24:15Z")

</div>

Hi, I’m trying to use a cmake-ninja built library from another buildsystem.

the problem is that, my cmake library internally built with vcpkg.  
which means that the library depends on several other libraries.

currently what I do is that build the cmake library using command line in a another buildsystem  
and link dependencies based on manually written path, cause I know paths anyway.

but I’d like to read dependencies, that library dependent, programmable way.  
not the way manually writing paths in a buildsystem.  
is there are some kind of cmake command or cmake code to use for this kind of purpose?

please don’t suggests me that unify build system with cmake(while I really do like to do), cause it is not possible.

---

<div class="post-metadata">

### Author: ![scivision](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/a87d85/32.png) [@scivision](https://discourse.cmake.org/u/scivision)
#### Post date: [March 3, 2023, 3:58pm UTC](https://discourse.cmake.org/t/is-there-are-way-to-read-dependencies-of-cmake-built-library/7592/2 "2023-03-03T15:58:39Z")

</div>

Perhaps CMake file-api? This is a standalone example that queries file-api for target information including libraries linked to each target.

> <https://gist.github.com/scivision/1018da4bb59ef1a05587209e2cedd43b>
>
> There are more than three files. show original

---

<div class="post-metadata">

### Author: ![hihig2001](https://discourse.cmake.org/user_avatar/discourse.cmake.org/hihig2001/32/2815_2.png) [@hihig2001](https://discourse.cmake.org/u/hihig2001)
#### Post date: [March 8, 2023, 2:41am UTC](https://discourse.cmake.org/t/is-there-are-way-to-read-dependencies-of-cmake-built-library/7592/3 "2023-03-08T02:41:11Z")

</div>

Thanks a lot! I knew there are something! It seems bit complex api than i thought though haha.  
I’ll look it up!

---

<div class="post-metadata">

### Author: ![scivision](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/a87d85/32.png) [@scivision](https://discourse.cmake.org/u/scivision)
#### Post date: [March 8, 2023, 2:05pm UTC](https://discourse.cmake.org/t/is-there-are-way-to-read-dependencies-of-cmake-built-library/7592/4 "2023-03-08T14:05:39Z")

</div>

Yeah, the file API is a bit complex to read but it’s meant to be used programmatically and is used by a number of significant programs like IDEs.
