Already explored couple of similar solutions in SO, none of them seems to work.
I created two wrapper scripts, changing PATH env for x86 and x64 versions of Qt, only for the period of debugging the application of specific application architecture.
For example, choosing x86 configuration, I need to add path to msvc2015\bin
and msvc2015\plugins\platforms
to be able to debug x86 Qt applications. For x64 it would be msvc2015_64\bin
and msvc2015_64\plugins\platforms
respectively.
As a first version I created script setup_path.cmd
and executed it as a pre-build step
setup_path.cmd
@echo off
set PATH=%PATH%;C:\Qt\5.11.2\msvc2015\bin;C:\Qt\5.11.2\msvc2015\plugins\platforms
...and called it as a pre-build step from CMakeLists.txt
add_custom_command(TARGET ${TARGET} PRE_BUILD COMMAND cmd /c ${CMAKE_CURRENT_SOURCE_DIR}/setup_path.cmd)
The path ${CMAKE_CURRENT_SOURCE_DIR}
does not contain spaces.
The scripts executed normally, but Qt application under the debugger still does not see Qt libraries and plugins.
I choose way editing PATH as the most obvious, probably there is more specific way for Qt, but I could not easily find in the documentation.