List all CMake tests with CTest

As a CMake project grows, increasing complexity can make it hard to discern what tests are to be run and their properties. Perhaps the project logic is unexpectedly omitting necessary tests. The CI system or human can verify the list of tests by:

ctest -N

For machine parsing and human-readable verbose details including fixtures and labels, output JSON:

ctest --show-only=json-v1

To ensure an accurate test list, the project must first be configured and built as usual:

cmake -B build

cmake --build build

ctest --test-dir build -N