making Ninja build output silent

i noticed that Ninja prints build commands to the console. With Unix Makefile this doesn’t happen. I don’t have verbose build enabled. Is there a way to make Ninja builds silent?

Reproducer:

cmake_minimum_required(VERSION 3.20)
project(MyProj)

add_custom_target(tgt ALL COMMAND echo hi)

results in the following build output:

-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/test/build
[1/1] cd /tmp/test/build && echo hi
hi

Notice the cd /tmp/test/build && echo hi output.
In Makefiles it doesn’t happen:

-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/test/build
hi
Built target tgt

When you add a description to the custom target or command, this will be printed instead.

AFAIK there is no way to silence Ninja output currently.

This PR may be of interest to you though since it adds --quiet to Ninja.

There is currently no release of Ninja that has the new --quiet flag as of 11/6/2021