CTest scripting + CMake presets?

For local development, I’ve got all of my configuration specified in configure/build/test presets. I’ve been looking at CTest scripting, and it looks like you have to specify all these options again in the arguments to ctest_build, ctest_test, etc.

Is it possible for these commands to read CMake presets? Am I missing something here…?

I am not sure if I understand you question right?

I use cmake --workflow --preset test --fresh
or ctest --build --preset test --rerun-failed

and this cmake workflow preset i.e.:

{
  "version": 6,
  "cmakeMinimumRequired": {
    "major": 3,
    "minor": 25,
    "patch": 0
  },
  "configurePresets": [
    {
      "name": "test",
      "displayName": "Default test Config",
      "description": "Default build using Ninja generator",
      "generator": "Ninja",
      "binaryDir": "${sourceDir}/build",
      "installDir": "${sourceDir}/stagedir",
      "cacheVariables": {
        "CMAKE_PREFIX_PATH": {
          "type": "path",
          "value": "${sourceDir}/stagedir"
        },
        "CMAKE_BUILD_TYPE": "Release",
        "CMAKE_CXX_EXTENSIONS": false,
        "CMAKE_CXX_STANDARD": "17",
        "CMAKE_CXX_STANDARD_REQUIRED": true
      },
      "environment": {
        "CMAKE_EXPORT_COMPILE_COMMANDS": "YES",
        "CPM_USE_LOCAL_PACKAGES": "NO",
        "CPM_SOURCE_CACHE": "NO"
      },
      "warnings": {
        "deprecated": true,
        "uninitialized": true
      }
    }
  ],
  "buildPresets": [
    {
      "name": "test",
      "configurePreset": "test",
      "targets": [
        "check-format"
      ]
    }
  ],
  "testPresets": [
    {
      "name": "test",
      "configurePreset": "test",
      "output": {
        "outputOnFailure": true
      },
      "execution": {
        "noTestsAction": "error",
        "stopOnFailure": false,
        "rerun-failed": true
      }
    }
  ],
  "packagePresets": [
    {
      "name": "test",
      "configurePreset": "test",
      "generators": [
        "TGZ"
      ]
    }
  ],
  "workflowPresets": [
    {
      "name": "test",
      "steps": [
        {
          "type": "configure",
          "name": "test"
        },
        {
          "type": "build",
          "name": "test"
        },
        {
          "type": "test",
          "name": "test"
        }
      ]
    }
  ]
}

I do too, when just running tests locally. But to actually run a dashboard, my current workflow is to configure first (using a CMake preset), and then cd into that build directory and run ctest -D Nightly -C Debug