CMakePresets.json: Could not read presets: Invalid preset

I’m trying to setup a CMakePresets.json file, included below. When I try to use it, I get a very basic error message: “Invalid preset”, with no details or context. I’ve validated this against the published schema, but there are no errors reported. I’ve double checked it against the documentation, but I don’t see any issues.

Is this a bug in the parser, or a problem with my file?

cc: @kyle.edwards

{
  "cmakeMinimumRequired": {
    "major": 3,
    "minor": 21,
    "patch": 0
  },
  "version": 3,
  "configurePresets": [
    {
      "name": "base",
      "hidden": true,
      "description": "Basic Thrust config for building tests, etc.",
      "cacheVariables": {
        "THRUST_ENABLE_EXAMPLES": true,
        "THRUST_ENABLE_TESTING": true,
        "THRUST_ENABLE_BENCHMARKS": true
      }
    },
    {
      "name": "base-mc-systems_none",
      "inherits": "base",
      "hidden": true,
      "description": "Base multiconfig with no systems enabled.",
      "cacheVariables": {
        "THRUST_ENABLE_MULTICONFIG": true,
        "THRUST_IGNORE_DEPRECATED_CPP_11": true,
        "THRUST_MULTICONFIG_ENABLE_DIALECT_ALL": true,
        "THRUST_MULTICONFIG_ENABLE_SYSTEM_CPP": false,
        "THRUST_MULTICONFIG_ENABLE_SYSTEM_TBB": false,
        "THRUST_MULTICONFIG_ENABLE_SYSTEM_OMP": false,
        "THRUST_MULTICONFIG_ENABLE_SYSTEM_CUDA": false
      }
    },
    {
      "name": "base-mc-systems_cuda",
      "inherits": "base-mc-systems_none",
      "hidden": true,
      "description": "Base multiconfig + CUDA config.",
      "cacheVariables": {
        "THRUST_DISABLE_ARCH_BY_DEFAULT": false,
        "THRUST_MULTICONFIG_ENABLE_SYSTEM_CPP": true,
        "THRUST_MULTICONFIG_ENABLE_SYSTEM_OMP": true,
        "THRUST_MULTICONFIG_ENABLE_SYSTEM_TBB": true,
        "THRUST_MULTICONFIG_ENABLE_SYSTEM_CUDA": true,
        "THRUST_MULTICONFIG_WORKLOAD": "SMALL",
        "THRUST_INCLUDE_CUB_CMAKE": true,
        "CUB_ENABLE_EXAMPLES": true,
        "CUB_ENABLE_TESTING": true,
        "CUB_ENABLE_HEADER_TESTING": true
      }
    },
    {
      "name": "base-mc-systems_nocuda",
      "inherits": "base-mc-systems_none",
      "hidden": true,
      "description": "Base multiconfig + CPU-only config.",
      "cacheVariables": {
        "THRUST_MULTICONFIG_ENABLE_SYSTEM_CPP": true,
        "THRUST_MULTICONFIG_ENABLE_SYSTEM_OMP": true,
        "THRUST_MULTICONFIG_ENABLE_SYSTEM_TBB": true,
        "THRUST_MULTICONFIG_WORKLOAD": "LARGE"
      }
    },
    {
      "name": "base-mc-systems_all",
      "inherits": "base-mc-systems_cuda",
      "hidden": true,
      "description": "Base multiconfig with all systems enabled.",
      "cacheVariables": {
        "THRUST_MULTICONFIG_WORKLOAD": "LARGE"
      }
    },
    {
      "name": "exhaustive",
      "inherits": "base-mc-systems_all",
      "description": "ci/local/build.bash's 'Exhaustive' coverage plan.",
      "binaryDir": "build",
      "cacheVariables": {}
    },
    {
      "name": "thorough",
      "inherits": "base-mc-systems_cuda",
      "description": "ci/local/build.bash's 'Thorough' coverage plan.",
      "binaryDir": "build",
      "cacheVariables": {
        "THRUST_DISABLE_ARCH_BY_DEFAULT": true,
        "THRUST_AUTO_DETECT_COMPUTE_ARCH": true,
        "THRUST_ENABLE_COMPUTE_50": true,
        "THRUST_ENABLE_COMPUTE_60": true,
        "THRUST_ENABLE_COMPUTE_70": true,
        "THRUST_ENABLE_COMPUTE_80": true
      }
    },
    {
      "name": "minimial",
      "inherits": "base-mc-system_cuda",
      "description": "ci/local/build.bash's 'Minimal' coverage plan.",
      "binaryDir": "build",
      "cacheVariables": {
        "THRUST_DISABLE_ARCH_BY_DEFAULT": true,
        "THRUST_AUTO_DETECT_COMPUTE_ARCH": true,
        "THRUST_MULTICONFIG_ENABLE_DIALECT_ALL": false,
        "THRUST_MULTICONFIG_ENABLE_DIALECT_LATEST": true,
        "THRUST_MULTICONFIG_ENABLE_SYSTEM_TBB": false,
        "THRUST_MULTICONFIG_ENABLE_SYSTEM_OMP": false
      }
    },
    {
      "name": "test",
      "inherits": "base-mc-system_cuda",
      "binaryDir": "build"
    }
  ],
  "testPresets": [
    {
      "name": "base",
      "hidden": true,
      "output": {
        "outputOnFailure": true
      },
      "execution": {
        "noTestsAction": "error",
        "stopOnFailure": false
      }
    },
    {
      "name": "base-no_cuda",
      "inherits": "base",
      "hidden": true,
      "filter": {
        "exclude": {
          "name": "^thrust\\.[^.]+\\.cuda\\.|^cub\\."
        }
      }
    },
    {
      "name": "base-all",
      "inherits": "base",
      "hidden": true
    },
    {
      "name": "test",
      "inherits": "base-no_cuda",
      "configurePreset": "test"
    }
  ]
}

Ah, solved it – I had a typo in one of the inherit fields, s/system_/systems_/ seems to fix it.

Sorry for the noise, and looking forward to https://gitlab.kitware.com/cmake/cmake/-/issues/21310 :slight_smile:

1 Like