CTest build-and-test with multi-config generators

What is the right way to call CTest in build-and-test mode with a multi-config generator? I see there’s a flag --build-config-sample, but it doesn’t let me set the build config directly.

Is --build-config not suitable?

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>
      [--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.

Ah, please file an issue, thanks.

It is there, but not where the OP it expected. It is a synonym for the -C option and therefore placed under Options section.

Do all of the Options apply to build-and-test mode? That isn’t at all clear. -C is definitely not mentioned under the “build and test” header.

I was reading [<options>...] this way, that all other options (not explicitely mentioned here) may be applied.