`cmake --test .`?

Hey all

I’m not a heavy C/C++ developer, but I help package stuff for the python ecosystem (specifically conda-forge), and – thankfully – more packages are moving to CMake, and away from autotools et al.

In the sequence of configure, build, test, install, it would be natural for me to have

mkdir build && cd build
cmake $ARGS ..
cmake --build .
cmake --test .
cmake --install .

but I cannot find anything about cmake --test – perhaps it’s just exceptionally hard to google for, but I cannot even tell if it exists. Neither is it clear how I can do the equivalent invocation across platforms.

In the most prominent docs, there’s no example of how to do this from the environment that’s calling cmake, except make test, which I’d like to avoid if possible [^1], and which doesn’t answer how this works on windows, for example.

I’ve found the following post that looks quite old (cmake_minimum_required(2.8)…) but at least offers an explanation & solution. Still, I was wondering if there’s something better here, and/or whether the docs need to be improved, and/or whether it would make sense to have a cmake --test sugar for whatever needs to happen (if it doesn’t exist yet).

[^1]: If I don’t need make to generate (having ninja), why should I need it just to run the tests…?

There is no cmake --test. Use ctest instead.