# Override base preset

**URL:** <https://discourse.cmake.org/t/override-base-preset/15903>\
**Category:** Usage\
**Created:** [November 6, 2026, 10:37am UTC](https://discourse.cmake.org/t/override-base-preset/15903 "2026-11-06T10:37:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wallby](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/w/4491bb/32.png) [@Wallby](https://discourse.cmake.org/u/Wallby)\
**Post date:** [November 6, 2026, 10:37am UTC](https://discourse.cmake.org/t/override-base-preset/15903/1 "2026-11-06T10:37:28Z")

</div>

I was thinking of adding cache variables in the CMakeUserPreset.json file for some project specific configuration. But I don’t want to have to override all of the presets defined in my CMakePresets.json file. Instead, I’d want to extend the base preset that all other non-user presets inherit from. But I can’t do that, as it errors about there being a duplicate preset. And there seems to not be a way to define global cache variables?

Below is sort of what I mean. In the user preset, I tried with and without `inherits` and `hidden`, but none of those worked.

CMakePresets.json

```json
{
  "version": 4,
  "configurePresets": [
    {
      "name": "all",
      "binaryDir": "some-folder",
      "hidden": true,
      "cacheVariables": {
        "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"`,
        //...
      }
    },
    {
      "name": "ninja",
      "inherits": "all",
      "generator": "Ninja Multi-Config"
    },
    {
      "name": "vs",
      "inherits": "all",
      "generator": "Visual Studio 18 2026"
    }
  ]
}

```

CMakeUserPresets.json

````json
{
  "version": 4,
  "configurePresets": [
    {
      "name": "all",
      //"inherits": "all",
      "hidden": true,
      "cacheVariables": {
        "PROJECT_1": "../project-1",
        "PROJECT_2": "../project-2"
      }
    }
  ]
}```
````

---

<div class="post-metadata">

**Author:** ![LegalizeAdulthood](https://discourse.cmake.org/user_avatar/discourse.cmake.org/legalizeadulthood/32/5282_2.png) [@LegalizeAdulthood](https://discourse.cmake.org/u/LegalizeAdulthood)\
**Post date:** [November 6, 2026, 2:47pm UTC](https://discourse.cmake.org/t/override-base-preset/15903/2 "2026-11-06T14:47:09Z")

</div>

The names of all presets exists in one ‘namespace’ if you will. Therefore you can’t have a user preset with the same name as a non-user preset. Use a different name.
