# Integrating CDash submission into a normal CI

**URL:** https://discourse.cmake.org/t/integrating-cdash-submission-into-a-normal-ci/15587
**Category:** Usage
**Tags:** os:linux, tool:cmake, tool:ctest
**Created:** [March 31, 2026, 12:33pm UTC](https://discourse.cmake.org/t/integrating-cdash-submission-into-a-normal-ci/15587 "2026-03-31T12:33:00Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![fsimonis](https://discourse.cmake.org/user_avatar/discourse.cmake.org/fsimonis/32/1712_2.png) [@fsimonis](https://discourse.cmake.org/u/fsimonis)
#### Post date: [March 31, 2026, 12:33pm UTC](https://discourse.cmake.org/t/integrating-cdash-submission-into-a-normal-ci/15587/1 "2026-03-31T12:33:01Z")

</div>

Hi, I’m having trouble integrating CDash into my project’s CI and haven’t found any good answers, so I’m asking here.

I manage a pretty standard CI that configures, builds, and tests a CMake project for a range of configurations. This project handles the entire test setup as part of the `CMakeLists.txt`, there is no CTestConfig in the root folder.

How do I:

1. specify the site name and build name using the command line or environment variables?
2. execute configuration, build, and tests as individual steps in the CI. I want to see quickly at which stage the CI fails. This rules out running everything as a single script.
3. use CDash without a CTestConfig in the root?

Thanks a lot!

---

<div class="post-metadata">

### Author: ![benthevining](https://discourse.cmake.org/user_avatar/discourse.cmake.org/benthevining/32/1924_2.png) [@benthevining](https://discourse.cmake.org/u/benthevining)
#### Post date: [March 31, 2026, 4:45pm UTC](https://discourse.cmake.org/t/integrating-cdash-submission-into-a-normal-ci/15587/2 "2026-03-31T16:45:36Z")

</div>

In practice, I do place a `CTestConfig.cmake` file in the repo root.

My CI workflows typically run something like `ctest -D Nightly`, but you could break it up and run each test phase (update, configure, build, test) as a separate step in your CI, ex:

- `ctest -D NightlyStart`
- `ctest -D NightlyUpdate`
- `ctest -D NightlyConfigure`

etc. See [the cli docs](https://cmake.org/cmake/help/latest/manual/ctest.1.html#dashboard-client).

---

<div class="post-metadata">

### Author: ![amadio](https://discourse.cmake.org/user_avatar/discourse.cmake.org/amadio/32/6023_2.png) [@amadio](https://discourse.cmake.org/u/amadio)
#### Post date: [April 2, 2026, 3:22pm UTC](https://discourse.cmake.org/t/integrating-cdash-submission-into-a-normal-ci/15587/3 "2026-04-02T15:22:05Z")

</div>

XRootD uses a custom script to submit from GitHub Actions to CDash.  
You can find the script here:

> <https://github.com/xrootd/xrootd/blob/master/test.cmake>

and the GitHub Actions workflow using it is here:

> <https://github.com/xrootd/xrootd/blob/master/.github/workflows/CI.yml>

It should be quite easy to adapt it to your project. I hope you find it useful.

Best regards,  
—Guilherme

---

<div class="post-metadata">

### Author: ![fsimonis](https://discourse.cmake.org/user_avatar/discourse.cmake.org/fsimonis/32/1712_2.png) [@fsimonis](https://discourse.cmake.org/u/fsimonis)
#### Post date: [April 2, 2026, 3:47pm UTC](https://discourse.cmake.org/t/integrating-cdash-submission-into-a-normal-ci/15587/4 "2026-04-02T15:47:05Z")

</div>

> [@benthevining](#):
>
> In practice, I do place a `CTestConfig.cmake` file in the repo root.

Do you generate this as part of the CI?

@amadio Thanks. This is a very good reference for a full script that ticks most of our boxes. The message grouping was on our mind, too. It helps to make the output a bit easier to read, but it doesn’t run individual steps.

---

<div class="post-metadata">

### Author: ![benthevining](https://discourse.cmake.org/user_avatar/discourse.cmake.org/benthevining/32/1924_2.png) [@benthevining](https://discourse.cmake.org/u/benthevining)
#### Post date: [April 2, 2026, 4:20pm UTC](https://discourse.cmake.org/t/integrating-cdash-submission-into-a-normal-ci/15587/5 "2026-04-02T16:20:43Z")

</div>

> [@fsimonis](#):
>
> Do you generate this as part of the CI?

No, why would you? It’s not a mortal sin for there to be a CTestConfig.cmake file sitting in the repo root of any normal git clone. It has project-specific information, so it belongs in the project, IMHO.

---

<div class="post-metadata">

### Author: ![fsimonis](https://discourse.cmake.org/user_avatar/discourse.cmake.org/fsimonis/32/1712_2.png) [@fsimonis](https://discourse.cmake.org/u/fsimonis)
#### Post date: [April 2, 2026, 5:48pm UTC](https://discourse.cmake.org/t/integrating-cdash-submission-into-a-normal-ci/15587/6 "2026-04-02T17:48:29Z")

</div>

[quote=“Ben Vining, post:5, topic:15587, username:benthevining”]  
No, why would you?… It has project-specific information, so it belongs in the project, IMHO.  
[/quote]

Some setting are run-specific though for example the name of the site/CI runner or the name of the build including configuration details etc.

Form my understanding, they also need to be part of the CTestConfig and it cannot depend on variables from the CMakeLists nor CMakeCache, so I need to patch or generate that file. And I don’t really want to patch files in the source directory based on some configuration in the binary directory.

---

<div class="post-metadata">

### Author: ![amadio](https://discourse.cmake.org/user_avatar/discourse.cmake.org/amadio/32/6023_2.png) [@amadio](https://discourse.cmake.org/u/amadio)
#### Post date: [April 2, 2026, 6:02pm UTC](https://discourse.cmake.org/t/integrating-cdash-submission-into-a-normal-ci/15587/7 "2026-04-02T18:02:18Z")

</div>

My script runs the steps in sequence with the split sections for messages, as you pointed out, and always does a ctest\_submit at the end, without running subsequent steps if a step fails. The reason I decided to run the steps together is that the submit step needs the build name and other things which I detect in the beginning, so if I did the steps separately, I’d have to rerun parts of the script multiple times. You can, however, use CTEST\_ARG or optional arguments to customize that script to run only certain steps. I have an optional step that installs the project, which is enabled with -DINSTALL=1, for example. Similarly for enabling clang-tidy, sanitizers, valgrind, etc. There’s also a .ci/config.cmake with default options, and per-OS detection for customizations. You could use that for your various configurations.

For CTestConfig.cmake, we have one in the project’s top directory. If you need customizations per build, you could use environment variables in the set commands within your CTestConfig.cmake, or use a CTestConfig.cmake.in to generate one in the build directory or have it done by the CI as you said.

Have a look here for an easier to follow description of our CI:

> **[XRootD and FTS Workshop @ PIC (Barcelona)](https://indico.cern.ch/event/1542060/contributions/6732645/)**
>
> LOGIN to see the Zoom connection details. :) The 2025 XRootD and FTS workshop will take place on 13-17 October, 2025, at Hotel Exe Campus, Universitat Autonoma de Barcelona (UAB), Bellaterra (Barcelona), Spain. This event will be hosted by PIC, which...

Cheers,

---

<div class="post-metadata">

### Author: ![benthevining](https://discourse.cmake.org/user_avatar/discourse.cmake.org/benthevining/32/1924_2.png) [@benthevining](https://discourse.cmake.org/u/benthevining)
#### Post date: [April 2, 2026, 6:16pm UTC](https://discourse.cmake.org/t/integrating-cdash-submission-into-a-normal-ci/15587/8 "2026-04-02T18:16:39Z")

</div>

No, the CTestConfig file contains only the following content:

```auto
set (CTEST_PROJECT_NAME ben-bot)
set (CTEST_NIGHTLY_START_TIME 01:00:00 UTC)
set (CTEST_SUBMIT_URL https://my.cdash.org/submit.php?project=ben-bot)
set (CTEST_DROP_SITE_CDASH TRUE)

```

All other settings should be specified elsewhere

---

<div class="post-metadata">

### Author: ![fsimonis](https://discourse.cmake.org/user_avatar/discourse.cmake.org/fsimonis/32/1712_2.png) [@fsimonis](https://discourse.cmake.org/u/fsimonis)
#### Post date: [April 8, 2026, 12:20pm UTC](https://discourse.cmake.org/t/integrating-cdash-submission-into-a-normal-ci/15587/9 "2026-04-08T12:20:20Z")

</div>

> [@amadio](#):
>
> use a CTestConfig.cmake.in to generate one in the build directory

The CTestConfig.cmake isn’t picked up in the build directory (CMake 3.31.6).

> [@benthevining](#):
>
> All other settings should be specified elsewhere

OK. I think I finally figured out the chain of information:

1. The `ctest` calls rely on the `DartConfiguration.tcl`
2. The `DartConfiguration.tcl` is generated when `include(CTest)` is called.
3. The CTest module reads the `CTestConfig.cmake` in the root of the source directory and what the documentation refers to as `CTest module variable`.

So, setting up CDash support without a standalone ctest script is possible via

- Populating the `CTest module variables` in `CMakeLists.txt` before calling `include(CTest)`. This can be done by
  - adding a `CTestConfig.cmake` to the root of your source directory,
  - programmatically in the `CMakeLists.txt` using `set()`,
  - by passing these via the CLI using `-D`, or
  - by [prepopulating the cache](https://cmake.org/cmake/help/latest/manual/cmake.1.html#cmdoption-cmake-C) using `-C`.

- Skip `include(CTest)` and directly generate the `DartConfiguration.tcl` [following the format](https://cmake.org/cmake/help/latest/manual/ctest.1.html#dashboard-client-via-ctest-command-line) specification.
