How to disable system directory search for file(GET_RUNTIME_DEPENDENCIES

We are building an executable with the visual studio compiler.
When deploying we want to include the msvc redist dll’s as customers might not have installed them.
Furthermore, we do not want to use those located in system32 on our CI and developer PC’s but want to use a fetched copy we store in a company repo.

I currently discovered file(GET_RUNTIME_DEPENDENCIES and am able to use it to find and install all but the system DLL’s with the regex: POST_EXCLUDE_REGEXES ".*WINDOWS.system32.*".
Also, I was able to copy the redist DLL’s with the regex: POST_INCLUDE_REGEXES ".*msvcp.*" ".*vccorlib.*" ".*vcruntime.*" ".*concrt.*" ".*ucrtbase.*".

But I cannot find a way to let the tool find the redist DLL’s in the given DIRECTORIES instead of system32.
The search order of the method cannot be changed as far as I can tell, but maybe there is some workaround?

Related: GET_RUNTIME_DEPENDENCIES has difficulties with windows API sets

I think the DIRECTORIES argument should work. I think these are pure fallbacks though and PRE_EXCLUDE will halt searching for the matched DLL. I think you may be able to use the PATH environment variable to influence searching though (by adding your fetched copy path at the beginning) That’s just a Windows thing though.

Cc: @kyle.edwards

1 Like

Hi!

Any update on this? I am trying to do the same. Hacking the PATH variable is not a viable solution for us.