microsoft / microsoft/vscode-cmake-tools

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

Open
#4,425 7 comments 0 reactions 1 assignee Claimed by @gcampbell-msft View on GitHub
bug Feature: presets
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

### Brief Issue Summary

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

```json
{
"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

```shell
{
"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

```shell
[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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.