How to save ctest_test() failed test summary into a variable/file?

I am running ctest as a dashboard client, and I am running it like this:


This prints a nice summary of failed and succeeded tests into stdout (err?), but I would like to save this summary into a file, to later send to the developers as feedback. How can I do so?

I don’t think there’s a way to do that from within the CTest script; you’d need to tee or otherwise save the output from the top-level ctest command.