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

Existing presets are not shown #1934

Closed
KUGA2 opened this issue Jun 16, 2021 · 6 comments
Closed

Existing presets are not shown #1934

KUGA2 opened this issue Jun 16, 2021 · 6 comments
Assignees
Labels
bug a bug in the product Feature: presets
Milestone

Comments

@KUGA2
Copy link

KUGA2 commented Jun 16, 2021

Brief Issue Summary

The plugin does not read existing (and working - tested via cli) presets in CMakePresets.json.

Expected:

From what I read here, klicking on the button "No Configure Preset Selected" should list my presets. It does not. If I add the example preset from CMake doc, it works.

Apparent Behavior:

It wants me to create a new preset. See video.
https://streamable.com/19sk8n

CMake Tools Log

There is an error here:

[presetController] Invalid kit contents CMakePresets.json (d:\git\platform_rts\CMakePresets.json):
[presetController]  >> /configurePresets/0/cacheVariables/CMAKE_BUILD_TYPE: should be equal to one of the allowed values
[presetController]  >> /configurePresets/0/cacheVariables/CMAKE_BUILD_TYPE: should be object
[presetController]  >> /configurePresets/0/cacheVariables/CMAKE_BUILD_TYPE: should match some schema in anyOf

So the reason is, that I specified a variable for CMAKE_BUILD_TYPE.

            "binaryDir": "${sourceDir}/Build/$env{TOOLCHAIN}-$env{BUILD_TYPE}-${generator}",
            "cacheVariables": {
                "CMAKE_INSTALL_PREFIX": "Build/EXPORT_PLATFORM",
                "CMAKE_BUILD_TYPE": "$env{BUILD_TYPE}",
                "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/Scripts/build_resources/Components/CMake/Toolchain/$env{TOOLCHAIN}.cmake"
            },
            "environment": {
                "TOOLCHAIN": "placeholder",
                "BUILD_TYPE": "Release"
            }

There is also a tooltip warning:
image

So I guess, I must disable this check somehow. How?
Otherwise I must hard code BUILD_TYPE, which apears at several locations (e.g. binary dir) and it cannot be in inherit configuration.

Platform and Versions

  • Operating System: Windows
  • CMake Version: 3.20.4
  • VSCode Version: 1.57
  • CMake Tools Extension Version: 1.7.3
  • Compiler/Toolchain: Visual C++ 2019
@bobbrow
Copy link
Member

bobbrow commented Jun 16, 2021

@xisui-MSFT @gugavaro Did we add CMAKE_BUILD_TYPE to the CMake schema when we pulled from their repo so we could get IntelliSense for it? What I see now seems to reject environment references.

                          "CMAKE_BUILD_TYPE": {
                              "anyOf": [
                                  {
                                      "type": "string",
                                      "description": "Specifies the build type on single-configuration generators.",
                                      "enum": [
                                          "Debug",
                                          "Release",
                                          "RelWithDebInfo",
                                          "MinSizeRel"
                                      ]
                                  },
                                  {
                                      "type": "object",
                                      "properties": {
                                          "type": {
                                              "type": "string"
                                          },
                                          "value": {
                                              "type": "string"
                                          }
                                      },
                                      "additionalProperties": false
                                  }
                              ]
                          }

@bobbrow bobbrow added Feature: presets bug a bug in the product labels Jun 16, 2021
@bobbrow bobbrow added this to the 1.8.0 milestone Jun 16, 2021
@bobbrow bobbrow self-assigned this Jun 16, 2021
@bobbrow
Copy link
Member

bobbrow commented Jun 16, 2021

I have a PR out for this. When it is committed, I will share a link to a build of the extension you can use to verify the fix and unblock your workflow.

Thank you for reporting this issue!

@bobbrow
Copy link
Member

bobbrow commented Jun 28, 2021

If you download and unzip the cmake-tools VSIX from here: https://github.com/microsoft/vscode-cmake-tools/suites/3078538279/artifacts/70210456

You can install it using the Extensions: Install from VSIX... command in VS Code and it should have a fix for this issue. Please try it out and let us know if it resolves your issue.

@KUGA2
Copy link
Author

KUGA2 commented Jun 29, 2021

Yes. I can confirm, that my $env{} in CMAKE_BUILD_TYPE works with the provided vsix.

@TheJCAB
Copy link
Member

TheJCAB commented Jul 15, 2021

Just bumped into this exact same issue. I can manage, but... can't wait to get the fix :-).

@bobbrow
Copy link
Member

bobbrow commented Jul 20, 2021

@TheJCAB You can get the fix now. Instructions are in my comment above.

@bobbrow bobbrow closed this as completed Aug 26, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jan 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug a bug in the product Feature: presets
Projects
None yet
Development

No branches or pull requests

3 participants