Reputation: 2561
I create usual hello-world Qt executable via cmake+msvc.
But I cant launch or debug it - the launсh fails by the reason of the absence needed Qt dll.
I found that if I add the
D:\libs\Qt\Qt5.14.2\5.14.2\msvc2017_64\bin;
D:\libs\Qt\Qt5.14.2\5.14.2\msvc2017_64\plugins\platforms;
to the PATH environment variable - the issue gone.
But I dont want that paths in the global environment variables (I plan to have few different versions of the Qt libraries, so all time switching global environment variables will be unusable).
How I could pass the paths to Qt librariles to the cmake for debug/launch executable without modifying the global environment variables?
Upvotes: 0
Views: 1360
Reputation: 11
here is my solution.
open Tools > Options > Debugging > Symbols > add new location.
the location is your qt MSVC bin floder, in my case is "D:\Qt\6.2.2\msvc2019_64\bin".
don't forget select new location, now you can use vs debug qt exe.
Upvotes: 1
Reputation: 6734
You can add the path to your local debugging environment to your CMake generated Visual Studio Solution, either by adding it in the GUI under Configuration Properties -> Debugging -> Environment
or (since CMake 3.13.0) in your CMakeLists.txt by setting the appropriate property on the target.
set_target_properties(exe_target PROPERTIES VS_DEBUGGER_ENVIRONMENT "PATH=D:\libs\Qt\Qt5.14.2\5.14.2\msvc2017_64\bin;D:\libs\Qt\Qt5.14.2\5.14.2\msvc2017_64\plugins\platforms")
Although these properties are prefixed with VS_DEBUGGER_
they apply to both the Debug and Release versions.
Other VS_DEBUGGER_
properties might be of interest too.
See here for documentation.
Upvotes: 0