vscode-qt-tools
vscode-qt-tools copied to clipboard
[feature] Support more Variable Substitution of `cmake tools`.
Problem to solve
According to the README.md
, it looks like qt-tools
only supports ${buildType}
, ${buildKit}
, and ${workspaceFolder}
now. If we use another Variable Substitution in cmake.buildDirectory
, the bottom status bar of qt-tools
will show "Qt not found". Therefore, we cannot use the command such as Qt: Launch Qt Designer
.
Can qt-tools
support more Variable Substitution of cmake-tools
?
Screenshots
Platform and Version:
- OS: Windows 11
- Qt Tools: 0.10.1
- VSCode: 1.65.2
@hwhsu1231 which Qt version do you use?
Typically the extension read the directory where the qt tools are automatically from the cmake build cache, so normally you don't need to configure anything.
Can you check if there are Qt variable in your cmake cache?
Here is what I test:
-
If I set the
cmake.buildDirectory
only with those mentioned in theREADME.md
, the bottom status bar will show "Qt found"."cmake.buildDirectory": "${workspaceFolder}/build/${buildType}"
-
If I set the
cmake.buildDirectory
with other Variable Substitution, the bottom status bar will show "Qt not found"."cmake.buildDirectory": "${workspaceFolder}/build/${buildKitTargetOs}-${buildKitVendor}-${buildKitTargetArch}-${buildType}"
Screenshots
By the way, the following are screenshots of my find_package()
in CMakeLists.txt
and Qt_DIR
in CMakeCache.txt
.
@tonka3000 How is this issue going?
@hwhsu1231 The variables are resolved by the cmake-extension itself. It seems that the vscode-cmake tools changed their behavior. Previously the buildDirectory
from the cmake-extension was set when something change in the settings.json
. Now it seems that it only set the buildDirectory
when you change the file and trigger cmake configure again. After that it works normally.
Please try this on your side
- Change the
cmake.BuildDirectory
to whatever you want include the other variable you mentioned above - Then trigger the command
cmake: Configure
- Then rescan for Qt
The current behavior is a fallback impl. when there is no cmake extension running. I can only support the given variables because cmake-tools has no APIs to get the other values.