vscode-cmake-tools icon indicating copy to clipboard operation
vscode-cmake-tools copied to clipboard

Presets in CMakeUserPresets.json can't reference configure presets in CMakePresets.json

Open benschreiber opened this issue 11 months ago • 0 comments

Brief Issue Summary

Consider the simple project

CMakeLists.txt

cmake_minimum_required(VERSION 3.27)
project(presetProblem)

CMakePresets.json

{
    "version": 6,
    "configurePresets": [
        {
            "name": "foo"
        }
    ]
}

CMakeUserPresets.json

{
    "version": 6,
    "buildPresets": [
        {
            "name": "bar",
            "configurePreset": "foo"
        }
    ]
}

cmake reports foo and bar as valid presets.

> cmake --list-presets
Available configure presets:

  "foo"
> cmake --build --list-presets
Available build presets:

  "bar"

CMake Tools v1.16.32 also validates both json files without issue.

But CMake Tools v1.17.15-1.17.17 report the error

Configure preset "foo" referenced in preset "bar" was not found.

CMake Tools Diagnostics

{
  "os": "win32",
  "vscodeVersion": "1.87.0",
  "cmtVersion": "1.17.17",
  "configurations": [
    {
      "folder": "c:\\Users\\bschreiber\\Developer\\cmake_repro",
      "cmakeVersion": "3.28.0",
      "configured": true,
      "generator": "Visual Studio 17 2022",
      "usesPresets": true,
      "compilers": {}
    }
  ],
  "cpptoolsIntegration": {
    "isReady": false,
    "hasCodeModel": false,
    "activeBuildType": "",
    "buildTypesSeen": [],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 0,
    "executablesCount": 0,
    "librariesCount": 0,
    "targets": []
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": false
    }
  ]
}

Debug Log

No response

Additional Information

No response

benschreiber avatar Mar 05 '24 22:03 benschreiber