tonka3000 / vscode-qt-tools

Qt tools extension for Visual Studio Code
MIT License
41 stars 10 forks source link

[feature] Support more Variable Substitution of `cmake tools`. #70

Open hwhsu1231 opened 2 years ago

hwhsu1231 commented 2 years ago

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

img--qt_not_found+qtdesigner_not_exists

Platform and Version:

tonka3000 commented 2 years ago

@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?

hwhsu1231 commented 2 years ago

Here is what I test:

Screenshots

img--Qt_found img--Qt_not_found

hwhsu1231 commented 2 years ago

By the way, the following are screenshots of my find_package() in CMakeLists.txt and Qt_DIR in CMakeCache.txt.

img--find_package img--Qt_DIR

hwhsu1231 commented 2 years ago

@tonka3000 How is this issue going?

tonka3000 commented 2 years ago

@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

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.