# minimum working example for CMakePresets.json

**URL:** <https://discourse.cmake.org/t/minimum-working-example-for-cmakepresets-json/3419>\
**Category:** Code\
**Created:** [May 26, 2021, 3:20pm UTC](https://discourse.cmake.org/t/minimum-working-example-for-cmakepresets-json/3419 "2021-05-26T15:20:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hex](https://discourse.cmake.org/user_avatar/discourse.cmake.org/hex/32/363_2.png) [@hex](https://discourse.cmake.org/u/hex)\
**Post date:** [May 26, 2021, 3:20pm UTC](https://discourse.cmake.org/t/minimum-working-example-for-cmakepresets-json/3419/1 "2021-05-26T15:20:46Z")

</div>

i am struggling to get CMakePresets.json to work.

consider the following CMakePresets.json:

```auto
{
  "version": 2,
}

```

the version field is required. When i ran with `cmake -S . --preset=default` i received:

```auto
CMake Error: Could not read presets from /home/user/test: JSON parse error

```

my cmake version is 3.20.2

---

<div class="post-metadata">

**Author:** ![fenrir](https://discourse.cmake.org/user_avatar/discourse.cmake.org/fenrir/32/734_2.png) [@fenrir](https://discourse.cmake.org/u/fenrir)\
**Post date:** [May 26, 2021, 3:26pm UTC](https://discourse.cmake.org/t/minimum-working-example-for-cmakepresets-json/3419/2 "2021-05-26T15:26:02Z")

</div>

JSON does not allow for trailing commas

---

<div class="post-metadata">

**Author:** ![hex](https://discourse.cmake.org/user_avatar/discourse.cmake.org/hex/32/363_2.png) [@hex](https://discourse.cmake.org/u/hex)\
**Post date:** [May 26, 2021, 3:33pm UTC](https://discourse.cmake.org/t/minimum-working-example-for-cmakepresets-json/3419/3 "2021-05-26T15:33:38Z")

</div>

thank you, that was the problem.

i was overlooking the `inherits` requirements, too. Below is working:

```json
{
  "version": 2,
  "configurePresets": [
    {
      "name": "default",
      "generator": "Ninja",
      "binaryDir": "${sourceDir}/build/default"
    }
  ]
}

```

---

<div class="post-metadata">

**Author:** ![yuvsaha123](https://discourse.cmake.org/user_avatar/discourse.cmake.org/yuvsaha123/32/2166_2.png) [@yuvsaha123](https://discourse.cmake.org/u/yuvsaha123)\
**Post date:** [February 4, 2022, 1:01pm UTC](https://discourse.cmake.org/t/minimum-working-example-for-cmakepresets-json/3419/4 "2022-02-04T13:01:44Z")

</div>

thanks for the awesome information.
