question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CMakePresets.json schema is too restrictive

See original GitHub issue

Brief Issue Summary

I cannot add the new CMake 3.21 feature “conditions” to the CMakePresets.json without breaking cmake-tools. Or any other feature that might come.

The plugin validates the CMakePresets.json and does not load it. The same issue was seen here https://github.com/microsoft/vscode-cmake-tools/issues/1934, but this Issue is for a more general issue.

Apparent Behaviour

Tooltip: image

And no preset found: image

Code:

        {
            "name": "x86_64-windows-user-vs2019-Release",
            ...
            "condition": {
                "type": "equals",
                "lhs": "$env{VSCMD_ARG_TGT_ARCH}",
                "rhs": "x64"
            }
        },

Expected:

It should leave the validation to cmake.exe. e.g. you could run cmake --list-presets and then offer those shown (this will also implicitly enable the condition feature).

$ set | grep VSCMD_ARG_TGT_ARCH
VSCMD_ARG_TGT_ARCH=x86

$ cmake --list-presets
Available configure presets:

  "x86-windows-user-vs2019-Release"

CMake Tools Log

[presetController] Invalid kit contents CMakePresets.json (d:\git\xx\CMakePresets.json):
[presetController]  >> /configurePresets/1: should NOT have additional properties
[presetController]  >> /configurePresets/2: should NOT have additional properties

Platform and Versions

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
esweet431commented, Jul 6, 2021

The recommendation is part of the IDE integration guide: https://cmake.org/cmake/help/latest/guide/ide-integration/index.html#presets

0reactions
KUGA2commented, Jul 5, 2021

Kitware’s recommendation to IDEs is to get the information out of the presets file and invoke the CLI with those parameters instead of using --preset.

I have also seen this recommendation but cannot find it anymore. Maybe they removed it? Can you link it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Existing presets are not shown · Issue #1934 - GitHub
Brief Issue Summary The plugin does not read existing (and working - tested via cli) presets in CMakePresets.json.
Read more >
Healthy Lifestyle Score items - Menzies Institute for Medical Research
bobbrow changed the title CMakePresets.json schema is to restrictive CMakePresets.json schema is too restrictive on 30 July 2021.
Read more >
Need a file which stores preset build options - GitLab
json file: CMakeSettings is very painful to use when a project has multiple potential presets, especially when many of them are similar to...
Read more >
CMakeUserPresets.json - Microsoft Learn
Schema reference for `CMakePresets.json` and ... It's so the same CMakePresets.json file can be used to drive CMake with Visual Studio, ...
Read more >
CMakeSettings.json schema does not allow non-standard ...
The schema used by CMakeSettings.json requires that the configurationType property is set to one of Release, RelWithDebInfo, MinSizerel or Debug.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found