Best practice for finding dlls from the buildtree


I’m used to RPATH under Linux, which makes running executables in the build
tree simple under Linux. Whatever shared libs have been linked, the executable
will find them via RPATH.

AFAIK such a feature still doesn’t exist under Windows.
So what is the recommended way to deal with this under Windows ?
I.e. if I link against some dlls which are somewhere else on the system, how
will the executable find them ?
Should I copy them to the build output directory during the configure-step
after find_package() ?
Or create a bat-file which sets PATH ? Would this work with debugging in Visual
Studio ? Or is there some other solution ?
For dlls built in the project, I guess the output directory should be set to
the same directory ?


For your own libraries, I recommend putting them all in the same place. For externals, you can assume they’ll be available via PATH or use the $<TARGET_RUNTIME_DLLS> generator expression.