The documentation implies that it isn’t available in build-and-test mode. But it indeed works.
See the “Build and Test” section. It shows the syntax as being:
ctest --build-and-test <path-to-source> <path-to-build>
--build-generator <generator>
[<options>...]
[--build-options <opts>...]
[--test-command <command> [<args>...]]
The text claims that the [<options>...] are enumerated below this section, and it doesn’t contain --build-config.