Skip to content

Fix overwriting of default CMake variants#367

Merged
lceWolf merged 1 commit intoCivitasv:masterfrom
haikion:fix-cmake-variant-settings
Feb 28, 2026
Merged

Fix overwriting of default CMake variants#367
lceWolf merged 1 commit intoCivitasv:masterfrom
haikion:fix-cmake-variant-settings

Conversation

@haikion
Copy link
Copy Markdown

@haikion haikion commented Feb 28, 2026

Fixes the following issue:

Preconditions

  • The project has at least one CMake option.
  • The project contains a cmake-variants.yaml file with default variants such as debug. Example here: CMake Variants

Steps:

  1. Edit an option to a non-default value within the settings section of cmake-variants.yaml.
  2. Check the generated CMakeCache.txt.

Expected: The option change is reflected in CMakeCache.txt.
Actual: The change is not reflected.

Here is a small hello world project for easier testing: hello.zip

I noticed that cmake-tools generates a default argument list if the variant name happens to match one of the defaults. I would assume this is intended behavior when no YAML file exists, but it also occurs when the file is present. I tested vscode-cmake-tools, and there the settings change works correctly.

@lceWolf lceWolf merged commit b744749 into Civitasv:master Feb 28, 2026
2 checks passed
@lceWolf
Copy link
Copy Markdown
Collaborator

lceWolf commented Feb 28, 2026

LGTM, thanks for your contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants