Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hwhsu1231 opened this issue Mar 16, 2022 · 5 comments
Open

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

hwhsu1231 opened this issue Mar 16, 2022 · 5 comments

Comments

@hwhsu1231
Copy link

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:

  • OS: Windows 11
  • Qt Tools: 0.10.1
  • VSCode: 1.65.2
@tonka3000
Copy link
Owner

@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
Copy link
Author

Here is what I test:

  • If I set the cmake.buildDirectory only with those mentioned in the README.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

img--Qt_found
img--Qt_not_found

@hwhsu1231
Copy link
Author

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
Copy link
Author

@tonka3000 How is this issue going?

@tonka3000
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants