Detect VERBOSE build in a macro?

I have a macro currently that runs an add_custom_command to compile f2py code in a model of mine. In order to keep the make install step output “clean”, I run this command with >& /dev/null because f2py is noisy. Very noisy.

But, I wondered, is there a way in a CMake macro like this to detect if someone is doing make install VERBOSE=1? Because it would be nice to pipe the output to /dev/null only during “normal” builds, but actually see this output in VERBOSE builds.

No, there’s no way to do that because each generator has different mechanisms. For example, it’s just a -v flag to ninja and commands have no visibility into that. I have no idea what Xcode or VS do here. The main purpose of the VERBOSE=1 flag is to show the commands being run, not affect the commands that are being run at all.

@ben.boeckel Dang. Well, it was just a thought to maybe avoid having a CMake option. But, I suppose that’s the way I might have to do it to keep it quiet for most, and noisy for a few.

You could always redirect it to a file instead. That way those who do care can go and look without having to rerun the command.