Instead of parsing the test names from the source code at configure time, query the list of tests from the test executables at testing time.
This should be upstreamed to CMake: https://gitlab.kitware.com/cmake/cmake/-/issues/26920
Left to do: The test_bitcoin-qt
executable should be fixed to support the -function
option documented here: https://doc.qt.io/qt-6/qtest-overview.html#testing-options so that its test cases can be discovered as well.