CMake 3.31 complains that USES_TERMINAL is not valid with add_custom_command(TARGET...)
CMake Warning (dev) at etc/cmake/benchmark_helpers.cmake:24 (add_custom_command):
The following keywords are not supported when using
add_custom_command(TARGET): USES_TERMINAL.
Policy CMP0175 is not set: add_custom_command() rejects invalid arguments.
Run "cmake --help-policy CMP0175" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Despite the warning that this argument is “invalid”, it does in fact have an effect. We use it to get terminal output for our benchmarking commands when using Ninja.
What is the supported way to achieve the same (i.e. terminal output for commands) with CMake 3.31? The goal is to add a benchmark target, with which we need to associate multiple commands, all of which should produce terminal output.
How do I achieve the effect of USE_TERMINAL in add_custom_command(TARGET...) with CMake 3.31? CMake 3.31 tells me that USE_TERMINAL is invalid in this context.
Instead of a post build custom command, you can make it custom target that depends on the target to benchmark and each benchmark encoded in its add_custom_command(OUTPUT…)
The output can be a file, e.g. the benchmark log or a dummy file.
I’m still confused about why a working feature seems to have been marked as “invalid”. I assume there must be a direct replacement for it. Is there?
I’d rather avoid ctest, which is influenced by the external environment (e.g., CTEST_PARALLEL_LEVEL) and can mess up benchmark results by parallelization, unless one is very careful.
Is the only option really to produce a dummy output file?
We’ll surely have to rework benchmarking in the future, but for now I’m just looking to restore functionality with minimum fuss.