get_prerequisites() tries to resolve system libraries even though advised not to

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.

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) instead which allows you to pass PRE_EXCLUDE_REGEXES to exclude these names from the resolution. See this discussion potential solutions to making this a lot easier to manage.