# get\_prerequisites() tries to resolve system libraries even though advised not to

**URL:** https://discourse.cmake.org/t/get-prerequisites-tries-to-resolve-system-libraries-even-though-advised-not-to/1148
**Category:** Code
**Created:** [May 5, 2020, 10:02am UTC](https://discourse.cmake.org/t/get-prerequisites-tries-to-resolve-system-libraries-even-though-advised-not-to/1148 "2020-05-05T10:02:33Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Stephan268](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/a87d85/32.png) [@Stephan268](https://discourse.cmake.org/u/Stephan268)
#### Post date: [May 5, 2020, 10:02am UTC](https://discourse.cmake.org/t/get-prerequisites-tries-to-resolve-system-libraries-even-though-advised-not-to/1148/1 "2020-05-05T10:02:33Z")

</div>

My cmake file calls

> get\_prerequisites() with exclude\_system = 1 and recurse = 1

My expectation is that system libraries are not processed, which is what I want because I do not want to include them in the binary package.

However I get warnings of this kind:

> warning: cannot resolve item ‘api-ms-win-crt-heap-l1-1-0.dll’
> 
> possible problems:  
> need more directories?  
> need to use InstallRequiredSystemLibraries?  
> run in install tree instead of build tree?
> 
> – info: non-absolute msvc file ‘api-ms-win-crt-heap-l1-1-0.dll’ returning type ‘system’

Is my expectation wrong, am I using get\_prerequisites() incorrectly or is this a bug in cmake.

I am using cmake 3.12.2 on Windows 10.

---

<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: [November 9, 2020, 8:10pm UTC](https://discourse.cmake.org/t/get-prerequisites-tries-to-resolve-system-libraries-even-though-advised-not-to/1148/2 "2020-11-09T20:10:08Z")

</div>

These DLL names are “magical” in that they don’t exist. `get_prerequisites` doesn’t know they’re system until it finds them, but since it can’t find them, it is unhappy. I would recommend using [`file(GET_RUNTIME_DEPENDENCIES)`](https://cmake.org/cmake/help/latest/command/file.html#get-runtime-dependencies) instead which allows you to pass `PRE_EXCLUDE_REGEXES` to exclude these names from the resolution. See [this discussion](https://discourse.cmake.org/t/get-runtime-dependencies-has-difficulties-with-windows-api-sets/1768) potential solutions to making this a lot easier to manage.
