Skip to content

Using presets version 4 causes schema validation to fail #2490

@madebr

Description

@madebr

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions