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

Using presets version 4 causes schema validation to fail #2490

Closed
madebr opened this issue Apr 9, 2022 · 4 comments · Fixed by #2493
Closed

Using presets version 4 causes schema validation to fail #2490

madebr opened this issue Apr 9, 2022 · 4 comments · Fixed by #2493
Labels
bug a bug in the product Feature: presets
Milestone

Comments

@madebr
Copy link

madebr commented Apr 9, 2022

Brief Issue Summary

I cannot configure a project with the VSCode CMake Tools when using a CMakePresets.json file targeted for the latest cmake version (=3.23.0).

CMake Tools Diagnostics

{
  "os": "linux",
  "vscodeVersion": "1.66.1",
  "cmtVersion": "1.11.7",
  "configurations": [
    {
      "folder": "/home/maarten/programming/temporary",
      "cmakeVersion": "3.23.0",
      "configured": false,
      "generator": "",
      "usesPresets": true,
      "compilers": {}
    }
  ],
  "cpptoolsIntegration": {
    "isReady": true,
    "hasCodeModel": true,
    "activeBuildType": "",
    "buildTypesSeen": [
      "Debug"
    ],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 1,
    "executablesCount": 1,
    "librariesCount": 0,
    "targets": [
      {
        "name": "main",
        "type": "EXECUTABLE"
      }
    ]
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": true
    }
  ]
}

Debug Log

No configuration happens, so I can't provide that.
But the following warnings appear in the OUTPUT panel:

[presetController]  >> /configurePresets/0: should NOT have additional properties: installDir
[presetController]  >> /configurePresets/2: should NOT have additional properties: condition

Additional Information

This is an example of a failing CMakePresets.json:

{
    "version": 4,
    "cmakeMinimumRequired": {
        "major": 3,
        "minor": 23,
        "patch": 0
    },
    "configurePresets": [
        {
            "name": "default",
            "displayName": "Common configure settings",
            "cacheVariables": {
                "CMAKE_BUILD_TYPE": {
                    "value": "RelWithDebInfo",
                    "type": "STRING"
                },
                "BUILD_TESTS": {
                    "value": "FALSE",
                    "type": "BOOL"
                }
            },
            "binaryDir": "build"
        },
        {
            "name": "devel",
            "displayName": "Common configure settings for developers",
            "inherits": "default",
            "cacheVariables": {
                "CMAKE_BUILD_TYPE": {
                    "value": "Debug",
                    "type": "STRING"
                },
                "BUILD_TESTS": {
                    "value": "TRUE",
                    "type": "BOOL"
                },
                "ENABLE_INSTALL": {
                    "value": "TRUE",
                    "type": "BOOL"
                },
                "DETHRACE_WERROR": {
                    "value": "TRUE",
                    "type": "BOOL"
                }
            },
            "warnings": {
                "dev": true
            },
            "binaryDir": "build",
            "installDir": "build/prefix"
        },
        {
            "name": "dev-macos",
            "displayName": "Developer settings for Macos",
            "inherits": ["devel"],
            "condition": {
                "type": "equals",
                "lhs": "${hostSystemName}",
                "rhs": "Darwin"
            }
        }
    ],
    "buildPresets": [
        {
            "name": "default",
            "configuration": "Debug",
            "configurePreset": "default"
        },
        {
            "name": "devel",
            "verbose": true,
            "inherits": ["default"],
            "configuration": "RelWithDebInfo",
            "configurePreset": "devel"
        }
    ],
    "testPresets": [
        {
            "name": "default",
            "configurePreset": "default",
            "configuration": "Debug",
            "output": {
                "verbosity": "verbose"
            }
        },
        {
            "name": "devel",
            "inherits": ["default"],
            "configurePreset": "devel",
            "configuration": "RelWithDebInfo"
        }
    ]
}

This file is correct as I can use it from the console + works in github workflows.

@elahehrashedi
Copy link
Contributor

If you change the "version": 4, to "version": 3, the error goes away.

@bobbrow
Copy link
Member

bobbrow commented Apr 11, 2022

We discovered a problem where if the version goes above what we currently know about, it actually picked the older version schema for validation. In this case, version 2. We'll fix that. @elahehrashedi opened issue #2492 for the full version 4 support.

@elahehrashedi
Copy link
Contributor

Follow up from here: #2492

@elahehrashedi elahehrashedi added the bug a bug in the product label Apr 11, 2022
@bobbrow bobbrow changed the title CMakePresets.json format of CMake 3.23 is not recognized Using presets version 4 causes schema validation to fail Apr 11, 2022
@bobbrow bobbrow added this to the On Deck milestone Apr 11, 2022
@bobbrow bobbrow linked a pull request Apr 11, 2022 that will close this issue
@bobbrow bobbrow modified the milestones: On Deck, 1.11.0 Apr 11, 2022
@bobbrow
Copy link
Member

bobbrow commented Apr 11, 2022

The fix is committed. This will be available in tomorrow's pre-release.

@bobbrow bobbrow closed this as completed Apr 11, 2022
@github-actions github-actions bot locked and limited conversation to collaborators May 27, 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

Successfully merging a pull request may close this issue.

3 participants