[WIP] CMake: Capture stderr when running tests.

A possible fix for #1301, based on @Islah's last comment there.
Split into two messages because `FATAL_ERROR` adds ugly newlines between the output:

```
  Unexpected output to stderr:

  E94: No matching buffer for _test_

  E94: No matching buffer for _test_

  E94: No matching buffer for _test_

  E94: No matching buffer for test

```