Skip to content

CMakePresets: Preset not shown when a common dependency is inherited more than once #2210

@dsterk-x

Description

@dsterk-x

Brief Issue Summary

It seems presets are not shown in the list of available presets if a common dependency is inherited more than once. For example via a transitive inheritance path.

How to reproduce

Using the example CMakePrests.json below. Then do Ctrl+Alt+P then type CMake: Select Configure Preset

{
    "version": 2,
    "configurePresets": [
        {
            "name": "default",
            "displayName": "default",
            "generator": "Ninja",
            "binaryDir": "${sourceDir}/build/default"
        },
        {
            "name": "foo",
            "inherits": "default",
            "displayName": "foo"
        },
        {
            "name": "foobar",
            "inherits": [
                "foo",
                "default"
            ],
            "displayName": "foobar"
        }
    ]
}

Expected Behavior

The above mentioned procedure shows the configure presets: "default", "foo" and "foobar".

Actual Behavior

The above mentioned procedure shows the configure presets: "default" and "foo". "foobar" is not listed.
When calling "cmake --list-presets", the output shows all expected presets.

$ cmake --list-presets
Available configure presets:

  "default" - default
  "foo"     - foo
  "foobar"  - foobar

It seems this behavior is related to inheritance of presets. If "foo" would not inherit from "default" all expected presets would be listed.

CMake Tools Diagnostics

{
  "os": "win32",
  "vscodeVersion": "1.61.2",
  "cmtVersion": "1.9.1",
  "configurations": [
    {
      "folder": "d:\\repos\\defective_preset",
      "cmakeVersion": "3.20.1",
      "configured": false,
      "generator": "",
      "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
    }
  ]
}

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