CMakePresets.json Error Messages - How can I decipher what the actual issue is.

I tend to get this a lot:

CMake Error: Could not read presets from /Users/mjackson/EMsoft-Dev/EMsoft: Invalid "configurePreset" field

I literally copied and pasted the contents from another project, and that project works just fine.

{
    "version": 3,
    "cmakeMinimumRequired": {
      "major": 3,
      "minor": 24,
      "patch": 0
    },
    "configurePresets": [
       {
        "name": "ci",
        "displayName": "CI build",
        "description": "Build configuration for GitHub Actions CI",
        "generator": "NMake Makefiles",
        "binaryDir": "${sourceDir}/build",
        "cacheVariables": {
            "CMAKE_BUILD_TYPE": {
                "type": "STRING",
                "value": "Release"
            },
            "bcls_DIR": {
                "type": "PATH",
                "value": "C:/Unknown"
            },
            "CLFORTRAN_DIR": {
                "type": "PATH",
                "value": "C:/Unknown"
            },
            "EIGEN_INSTALL": {
                "type": "PATH",
                "value": "C:/Unknown"
            },
            "FFTW3_INSTALL": {
                "type": "PATH",
                "value": "C:/Unknown"
            },
            "HDF5_DIR": {
                "type": "PATH",
                "value": "C:/Unknown"
            },
            "JSONFORTRAN_DIR": {
                "type": "PATH",
                "value": "C:/Unknown"
            }            
          }
       } 
    ],
    "buildPresets": [
        {
            "name": "ci-windows-v142",
            "displayName": "ci-windows-v142 Release build",
            "description": "Build configuration for GitHub actions CI",
            "configurePreset": "ci-windows-v142",
            "configuration": "Release"
        },
        {
            "name": "ci-windows-v143",
            "displayName": "ci-windows-v143 CI build",
            "description": "Build configuration for GitHub actions CI",
            "configurePreset": "ci-windows-v143",
            "configuration": "Release"
        }
    ],
    "testPresets": [
    ]
}

That is my json file. Now, there is most likely something very subtle incorrect in there. I’m using CMake 3.26.something. Would it be possible to actually print out an error message that is helpful. Line number maybe? What is the invalid field? There was clearly a check done on something that came up invalid, could I get that information somehow?

Is it space versus tabs? Is it 2 spaces versus 4 spaces for indentation?

Invalid “configurePreset”: “ci-windows-v142”

You should only reference existing configurePreset!

i.e.

{
            "name": "ci-windows-v143",
            "displayName": "ci-windows-v143 CI build",
            "description": "Build configuration for GitHub actions CI",
            "configurePreset": "ci",
            "configuration": "Release"
        }

In my haste to paste in an example I pasted the wrong file.

{
  "version": 3,
  "cmakeMinimumRequired": {
    "major": 3,
    "minor": 24,
    "patch": 0
  },
  "configurePresets": [
    {
      "name": "ci",
      "displayName": "CI build",
      "description": "Build configuration for GitLab.BlueQuartz.Net",
      "generator": "Ninja",
      "cacheVariables": {
        "VCPKG_MANIFEST_DIR": {
          "type": "STRING",
          "value": "${sourceDir}/"
        },
        "VCPKG_MANIFEST_FEATURES": {
          "type": "STRING",
          "value": "tests;parallel;itk;ebsd"
        },
        "VCPKG_OVERLAY_TRIPLETS": {
          "type": "PATH",
          "value": "${sourceDir}/cmake/triplets"
        },
        "VCPKG_INSTALLED_DIR": {
          "type": "STRING",
          "value": "${sourceDir}/../vcpkg-installed-simpl"
        },
        "CMAKE_TOOLCHAIN_FILE": {
          "type": "FILEPATH",
          "value": "$env{VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake"
        },
        "CMAKE_BUILD_TYPE": {
          "type": "STRING",
          "value": "Release"
        },
        "BUILD_SHARED_LIBS": {
          "type": "BOOL",
          "value": "ON"
        },
        "DREAM3D_DATA_DIR": {
          "type": "PATH",
          "value": "${sourceDir}/../DREAM3D_Data"
        },
        "DREAM3D_EXTRA_PLUGINS":{
          "type": "STRING",
          "value": "ITKImageProcessing;SimulationIO;DREAM3DReview;UCSBUtilities"
        },
        "SIMPL_WRAP_PYTHON": {
          "type": "BOOL",
          "value": "OFF"
        },
        "SIMPL_ENABLE_ANACONDA_PACKAGE": {
          "type": "BOOL",
          "value": "OFF"
        },
        "ANACONDA_ENVIRONMENT_NAME": {
          "type": "STRING",
          "value": "dream3d"
        },
        "SIMPL_ENABLE_ANACONDA_LOCAL_INSTALL": {
          "type": "BOOL",
          "value": "ON"
        },
        "ANACONDA_DIR": {
          "type": "PATH",
          "value": "/opt/local/anaconda3"
        },
        "PYTHON_EXECUTABLE": {
          "type": "PATH",
          "value": "/opt/local/anaconda3/envs/dream3d/bin/python"
        },
        "MKDOCS_PYTHON_EXECUTABLE": {
          "type": "PATH",
          "value": "/opt/local/anaconda3/envs/dream3d/bin/python"
        },
        "MKDOCS_EXECUTABLE": {
          "type": "PATH",
          "value": "/opt/local/anaconda3/envs/dream3d/bin/mkdocs"
        },
        "MYPY_STUBGEN_EXE": {
          "type": "PATH",
          "value": "/opt/local/anaconda3/envs/dream3d/bin/stubgen"
        },
        "SIMPL_USE_QtWebEngine": {
          "type": "BOOL",
          "value": "OFF"
        },
        "SIMPL_BUILD_CLI_TOOLS": {
          "type": "BOOL",
          "value": "ON"
        },
        "SIMPL_BUILD_TESTING": {
          "type": "BOOL",
          "value": "ON"
        },
        "SIMPL_RELATIVE_PATH_CHECK": {
          "type": "BOOL",
          "value": "ON"
        },
        "SIMPL_USE_MKDOCS": {
          "type": "BOOL",
          "value": "ON"
        },
        "SIMPLView_USE_STYLESHEETEDITOR": {
          "type": "BOOL",
          "value": "OFF"
        },
        "SIMPLView_BUILD_DevHelper": {
          "type": "BOOL",
          "value": "OFF"
        },
        "SIMPLView_BUILD_CLI_TOOLS": {
          "type": "BOOL",
          "value": "ON"
        },
        "SIMPLView_BUILD_DOCUMENTATION": {
          "type": "BOOL",
          "value": "ON"
        },
        "DREAM3D_BUILD_VERSION_FILE": {
          "type": "BOOL",
          "value": "ON"
        },
        "DREAM3D_BUILD_TEST_FILTERS": {
          "type": "BOOL",
          "value": "ON"
        },
        "ITKImageProcessing_ENABLE_SCIFIO": {
          "type": "BOOL",
          "value": "OFF"
        },
        "BrandedSIMPLView_DIR": {
          "type": "PATH",
          "value": "${sourceDir}/../BrandedDREAM3D"
        }
      }
    },
    {
      "name": "ci-windows-v142",
      "displayName": "ci-windows-v142",
      "description": "Build configuration for Azure DREAM3D NX CI",
      "generator": "Ninja",
      "inherits": "ci",
      "cacheVariables": {
        "VCPKG_TARGET_TRIPLET": {
          "type": "STRING",
          "value": "x64-windows-v142"
        },
        "VCPKG_HOST_TRIPLET": {
          "type": "STRING",
          "value": "x64-windows-v142"
        },
        "Python3_EXECUTABLE": {
          "type": "PATH",
          "value": "C:/Applications/Anaconda3/envs/dream3d/python.exe"
        },
        "MKDOCS_EXECUTABLE": {
          "type": "PATH",
          "value": "C:/Applications/Anaconda3/envs/dream3d/Scripts/mkdocs.exe"
        },
        "VTK_DIR": {
          "type": "PATH",
          "value": "E:/NX_SDK_VS/VTK-9.2.6/lib/cmake/vtk-9.2"
        },
        "Qt6_DIR": {
          "type": "PATH",
          "value": "E:/NX_SDK/Qt/6.5.0/msvc2019_64/lib/cmake/Qt6"
        }
      },
      "environment": {
        "VCPKG_INSTALLATION_ROOT": "E:/AzureDevOps/vcpkg",
        "VCPKG_BINARY_SOURCES": "files,E:/AzureDevOps/AppData,readwrite",
        "APPDATA": "E:/AzureDevOps/AppData"
      }
    },
    {
      "name": "ci-windows-v143",
      "displayName": "ci-windows-v143",
      "description": "Build configuration for Azure DREAM3D NX CI",
      "generator": "Visual Studio 17 2022",
      "inherits": "ci",
      "cacheVariables": {
        "VCPKG_TARGET_TRIPLET": {
          "type": "STRING",
          "value": "x64-windows-v143"
        },
        "VCPKG_HOST_TRIPLET": {
          "type": "STRING",
          "value": "x64-windows-v143"
        },
        "Python3_EXECUTABLE": {
          "type": "PATH",
          "value": "C:/Applications/Anaconda3/envs/dream3d/python.exe"
        },
        "MKDOCS_EXECUTABLE": {
          "type": "PATH",
          "value": "C:/Applications/Anaconda3/envs/dream3d/Scripts/mkdocs.exe"
        },
        "VTK_DIR": {
          "type": "PATH",
          "value": "E:/NX_SDK_VS/VTK-9.2.6/lib/cmake/vtk-9.2"
        },
        "Qt6_DIR": {
          "type": "PATH",
          "value": "E:/NX_SDK/Qt/6.5.0/msvc2019_64/lib/cmake/Qt6"
        }
      },
      "environment": {
        "VCPKG_INSTALLATION_ROOT": "E:/AzureDevOps/vcpkg",
        "VCPKG_BINARY_SOURCES": "files,E:/AzureDevOps/AppData,readwrite",
        "APPDATA": "E:/AzureDevOps/AppData"
      }
    }
  ],
  "buildPresets": [
    {
      "name": "ci-windows-v142",
      "displayName": "ci-windows-v142 Release build",
      "description": "Build configuration for Azure DREAM3D NX CI",
      "configurePreset": "ci-windows-v142",
      "configuration": "Release"
    },
    {
      "name": "ci-windows-v143",
      "displayName": "ci-windows-v143 CI build",
      "description": "Build configuration for Azure DREAM3D NX CI",
      "configurePreset": "ci-windows-v143",
      "configuration": "Release"
    },
    {
      "name": "ci-macos-x64",
      "displayName": "ci-macos-x64 CI build",
      "description": "Build configuration for Azure DREAM3D NX CI",
      "configurePreset": "ci-macos-x64",
      "configuration": "Release"
    },
    {
      "name": "ci-linux-x64",
      "displayName": "ci-linux-x64 CI build",
      "description": "Build configuration for Azure DREAM3D NX CI",
      "configurePreset": "ci-linux-x64",
      "configuration": "Release"
    }
  ],
  "testPresets": [
    {
      "name": "ci-windows-v142",
      "displayName": "ci-windows-v142 CI build",
      "description": "Build configuration for Azure DREAM3D NX CI",
      "configurePreset": "ci-windows-v142",
      "configuration": "Release",
      "output": {
        "outputOnFailure": true
      }
    },
    {
      "name": "ci-windows-v143",
      "displayName": "ci-windows-v143 CI build",
      "description": "Build configuration for Azure DREAM3D NX CI",
      "configurePreset": "ci-windows-v143",
      "configuration": "Release",
      "output": {
        "outputOnFailure": true
      }
    },
    {
      "name": "ci-macos-x64",
      "displayName": "ci-macos-x64 CI build",
      "description": "Build configuration for Azure DREAM3D NX CI",
      "configurePreset": "ci-macos-x64",
      "configuration": "Release",
      "output": {
        "outputOnFailure": true
      }
    },
    {
      "name": "ci-linux-x64",
      "displayName": "ci-linux-x64 CI build",
      "description": "Build configuration for Azure DREAM3D NX CI",
      "configurePreset": "ci-linux-x64",
      "configuration": "Release",
      "output": {
        "outputOnFailure": true
      }
    }
  ]
}

And I get:

1006:[mjackson@octane:DREAM3D]% cmake --preset ci-windows-v142
CMake Error: Could not read presets from /Users/mjackson/DREAM3D-Dev/DREAM3D: Invalid "configurePreset" field

you reference non existing configuration presets!

bash-5.2$ egrep -wn '(configurePreset|name)' *.json
10:      "name": "ci",
142:      "name": "ci-windows-v142",
180:      "name": "ci-windows-v143",
220:      "name": "ci-windows-v142",
223:      "configurePreset": "ci-windows-v142",
227:      "name": "ci-windows-v143",
230:      "configurePreset": "ci-windows-v143",
234:      "name": "ci-macos-x64",
237:      "configurePreset": "ci-macos-x64", <<<
241:      "name": "ci-linux-x64",
244:      "configurePreset": "ci-linux-x64", <<<
250:      "name": "ci-windows-v142",
253:      "configurePreset": "ci-windows-v142",
260:      "name": "ci-windows-v143",
263:      "configurePreset": "ci-windows-v143",
270:      "name": "ci-macos-x64",
273:      "configurePreset": "ci-macos-x64", <<<
280:      "name": "ci-linux-x64",
283:      "configurePreset": "ci-linux-x64", <<<
bash-5.2$ 

bash-5.2$ cmake --preset .
CMake Error: Could not read presets from /Users/clausklein/Workspace/cmake/WindowsToolchain:
Invalid "configurePreset": "ci-linux-x64"
bash-5.2$ cmake --version
cmake version 3.29.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).
bash-5.2$ 

The error message points me to the “Configure Presets” area of the file. That is where I am looking for errors. But what you are saying is that I need to somehow understand that CMake didn’t really like something down in the “Build Presets” because it referenced something up in the Configure Presets area that did not exist.

I mean, at least your version of CMake starts to give you a hint as to what is going wrong.

The error should be:

CMake Error: Build preset "ci-linux-x64" references a configure preset "ci-linux-x64" that does not exist.
Missing "configurePreset": "ci-linux-x64"

Now I, as the user, have direct, actionable information to go fix my file.