What happens when vs_link_exe copies dependent exes?

I’m getting loader errors from a CMake project I work on (Halide). Here’s what I observe:

I have Halide.dll in my installed directory. It has md5sum 8676341266e7f5ceb450b98df32f00ab and size 87210496 bytes.

When I try to compile a project that uses the CMake package including it, it creates a “copy” in the same folder as my executable with md5sum b5acb133d83224cc40c77431723b1897 and size 86905856 bytes.

The latter is missing exports that I can see in the former. I’m beyond confused.
If I manually copy the former Halide.dll over the latter, things work.

Using CMake 3.19 (also tried with 3.18, same deal) and WINDOWS_EXPORT_ALL_SYMBOLS is on.

It was actually vcpkg preferring the installed version of my package from its tree rather than the development one I was working on. That behavior is wild.

Removing Halide from vcpkg fixed it. So would have setting -DVCPKG_APPLOCAL_DEPS=NO.

I’ll leave this Q/A up for anyone who runs into similar issues developing a package that is also upstreamed in vcpkg.

The first error message I got was:

The procedure entry point […] could not my located in the dynamic link library