Skip to content

[Bug] condition in inherited build preset passes, but inherited build presets are not listed for selection #4425

@david-fong

Description

@david-fong

Brief Issue Summary

I'm using CMake v4.0. I can repro with my emscripten presets in david-fong/okiidoku@399fcdb. I can't work up the motivation to make a minimal repro right now- apologies. Relevant snippets from my preset file:

		{
			"name": "tool:emscripten",
			"hidden": true,
			"description": "available if you set/export EMSDK environment variable. good for IDEs which are hard to configure to use `emcmake cmake`.",
			"condition": {"type": "notEquals", "lhs": "$env{EMSDK}", "rhs": ""},
			"toolchainFile": "$env{EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake",
			"cacheVariables": {
				"CMAKE_CONFIGURATION_TYPES": "MinSizeRel;Debug;Release",
				"OKIIDOKU_BUILD_BINDINGS_FOR_PYTHON": null
			}
		},
//...
		{
			"name": "base:dev.emscripten",
			"hidden": true,
			"condition": {"type": "notEquals", "lhs": "$env{EMSDK}", "rhs": ""},
			"targets": ["all"]
		},
		{
			"name": "dev.emscripten.debug",
			"configurePreset": "dev.emscripten",
			"displayName": "debug",
			"inherits": ["base:dev.emscripten"],
			"configuration": "Debug"
		},

cmake --build --list-presets works as expected though.

CMake Tools Diagnostics

{
  "os": "linux",
  "vscodeVersion": "1.99.3",
  "cmtVersion": "1.21.17",
  "configurations": [
    {
      "folder": "/home/.../ok",
      "cmakeVersion": "4.0.1",
      "configured": true,
      "generator": "Ninja Multi-Config",
      "usesPresets": true,
      "compilers": {}
    }
  ],
  "cpptoolsIntegration": {
    "isReady": true,
    "hasCodeModel": true,
    "activeBuildType": "MinSizeRel",
    "buildTypesSeen": [
      "MinSizeRel",
      "Debug",
      "Release"
    ],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 5,
    "executablesCount": 3,
    "librariesCount": 2,
    "targets": [
      {
        "name": "okiidoku",
        "type": "STATIC_LIBRARY"
      },
      {
        "name": "okiidoku_cli",
        "type": "EXECUTABLE"
      },
      {
        "name": "okiidoku_cli_utils",
        "type": "STATIC_LIBRARY"
      },
      {
        "name": "okiidoku_js",
        "type": "EXECUTABLE"
      },
      {
        "name": "okiidoku_translator",
        "type": "EXECUTABLE"
      }
    ]
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "always",
      "configureOnOpen": false
    }
  ]
}

Debug Log

[presetController] Successfully expanded presets file /home/.../ok/cpp/CMakePresets.json
[driver] Switching to configure preset: dev.emscripten
[driver] Switching to build preset: __defaultBuildPreset__
[driver] Switching to test preset: __defaultTestPreset__
[driver] Switching to package preset: dev.emscripten.release
[driver] Switching to workflow preset: __defaultWorkflowPreset__
[extension] [1900] cmake.buildDirectory started
[extension] [1900] cmake.buildDirectory finished (returned "/home/.../ok/cpp/out/build/dev.emscripten")
[extension] [6898] cmake.selectBuildPreset started
[presetController] Start selection of build presets. Found 4 presets.
[presetController] Opening build preset selection QuickPick
[presetController] User cancelled build preset selection
[extension] [6898] cmake.selectBuildPreset finished (returned false)


It says it found 4, but only shows "\[Default\]" and "Add new preset".

Additional Information

I'm surprised CMake's file api doesn't seem to have much to support tools in implementing preset support.

Metadata

Metadata

Labels

Type

No type

Projects

Status

Completed

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions