# Help with presets: invalid preset

**URL:** https://discourse.cmake.org/t/help-with-presets-invalid-preset/3483
**Category:** Usage
**Created:** [June 3, 2021, 6:49pm UTC](https://discourse.cmake.org/t/help-with-presets-invalid-preset/3483 "2021-06-03T18:49:36Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![mathomp4](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mathomp4/32/176_2.png) [@mathomp4](https://discourse.cmake.org/u/mathomp4)
#### Post date: [June 3, 2021, 6:49pm UTC](https://discourse.cmake.org/t/help-with-presets-invalid-preset/3483/1 "2021-06-03T18:49:36Z")

</div>

Once again, my CMake lack-of-knowledge is laid bare. I decided today to play around with presets and whipped up this file:

```json
{
  "version": 2,
  "cmakeMinimumRequired": {
    "major": 3,
    "minor": 20,
    "patch": 3
  },
  "configurePresets": [
    {
      "name": "Release",
      "displayName": "Release Config",
      "description": "Release build using GNU Make generator",
      "generator": "Unix Makefiles",
      "binaryDir": "${sourceDir}/build-Release",
      "cacheVariables": {
        "BASEDIR": "$env{BASEDIR}/Darwin",
        "CMAKE_BUILD_TYPE": "Release",
        "CMAKE_INSTALL_PREFIX": "${sourceDir}/install-Release"
      }
    }
  ],
  "buildPresets": [
    {
      "name": "Release",
      "configurePreset": "Release",
      "targets": "install"
    }
  ]
}

```

I’m mainly piggybacking off of other examples I saw out there.

What I’m aiming for is for this to be equivalent to:

```auto
mkdir build-Release
cd build-Release
cmake .. -DBASEDIR=$BASEDIR/Darwin -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../install-Release

```

However, I must have got something wrong:

```auto
❯ cmake --version
cmake version 3.20.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).
❯ cmake -S . --list-presets
CMake Error: Could not read presets from /Users/mathomp4/Models/MAPL-Try/MAPL: Invalid preset

```

I’m sure it’s blindingly obvious, but I’m just stumped!

---

<div class="post-metadata">

### Author: ![kyle.edwards](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/65b543/32.png) [@kyle.edwards](https://discourse.cmake.org/u/kyle.edwards)
#### Post date: [June 3, 2021, 6:59pm UTC](https://discourse.cmake.org/t/help-with-presets-invalid-preset/3483/2 "2021-06-03T18:59:50Z")

</div>

Looks like there’s been a mistake on our end. The documentation claims that `target` can be either a string or a list of strings, but it only seems to accept a list of strings. I’ll open a bug on GitLab.

---

<div class="post-metadata">

### Author: ![kyle.edwards](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/65b543/32.png) [@kyle.edwards](https://discourse.cmake.org/u/kyle.edwards)
#### Post date: [June 3, 2021, 7:01pm UTC](https://discourse.cmake.org/t/help-with-presets-invalid-preset/3483/3 "2021-06-03T19:01:32Z")

</div>

See [https://gitlab.kitware.com/cmake/cmake/-/issues/22272](https://gitlab.kitware.com/cmake/cmake/-/issues/22272).

---

<div class="post-metadata">

### Author: ![mathomp4](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mathomp4/32/176_2.png) [@mathomp4](https://discourse.cmake.org/u/mathomp4)
#### Post date: [June 3, 2021, 7:11pm UTC](https://discourse.cmake.org/t/help-with-presets-invalid-preset/3483/4 "2021-06-03T19:11:48Z")

</div>

Ahhh. Gotcha. this:

```json
"targets": ["install"]

```

seems happier:

```auto
❯ cmake -S . --list-presets
Available configure presets:

  "Release" - Release Config

```

---

<div class="post-metadata">

### Author: ![mathomp4](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mathomp4/32/176_2.png) [@mathomp4](https://discourse.cmake.org/u/mathomp4)
#### Post date: [June 3, 2021, 7:28pm UTC](https://discourse.cmake.org/t/help-with-presets-invalid-preset/3483/5 "2021-06-03T19:28:08Z")

</div>

New oddity @kyle.edwards . So I fiddled some more and did this:

```json
  "buildPresets": [
    {
      "name": "Release",
      "configurePreset": "Release",
      "jobs": 4,
      "targets": ["install"]
    }
  ]

```

Adding the `jobs` field/key/thing. I guess my hope is that:

```auto
cmake --preset=Release
cmake --build --preset=Release

```

where the last one would be like:

```auto
cmake --build --preset=Release -j4

```

but it doesn’t seem to be doing things in parallel. Just ye olde `-j 1`. If I add on the `-j 4` then it does seem to do 4 jobs at once.

---

<div class="post-metadata">

### Author: ![kyle.edwards](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/65b543/32.png) [@kyle.edwards](https://discourse.cmake.org/u/kyle.edwards)
#### Post date: [June 3, 2021, 7:30pm UTC](https://discourse.cmake.org/t/help-with-presets-invalid-preset/3483/6 "2021-06-03T19:30:54Z")

</div>

Please open a bug on [GitLab](https://gitlab.kitware.com/cmake/cmake/-/issues) for that.

---

<div class="post-metadata">

### Author: ![mathomp4](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mathomp4/32/176_2.png) [@mathomp4](https://discourse.cmake.org/u/mathomp4)
#### Post date: [June 3, 2021, 7:40pm UTC](https://discourse.cmake.org/t/help-with-presets-invalid-preset/3483/7 "2021-06-03T19:40:38Z")

</div>

Done. See [https://gitlab.kitware.com/cmake/cmake/-/issues/22273](https://gitlab.kitware.com/cmake/cmake/-/issues/22273)
