Description
I use VSCode with CMake-Tools plugin to write/debug the CMake project. After the executable is generated, it needs to find those DLL files on Windows when using xxx:shared=True
option. If we don't want to use imports section to copy those DLL file to where executable locates, we can use VirtualRunEnv
generator to use PATH
to find them. According to the reply: #11040 (comment)
Yes, you could use the VirtualRunEnv generator, to generate scripts that will add those paths to the PATH and after sourcing those generated scripts the system will find the dll's for those libraries, please check the VirtualRunEnv documentation for more detailed information.
However, although VirtualRunEnv
generators provide scripts(conanrun.(bat|sh)
) to setup the environment variables, it seems that VSCode doesn't provide the features to preload those *.bat
or *.sh
file in launch.json
, dynamically. The only way to do that is to use envFile
option to load *.env
file to setup environment.
If VirtualRunEnv
generator can generate conanrun.env
additionally, that would be helpful when using launch.json
to debug the executable. For example: