# Detect VERBOSE build in a macro?

**URL:** <https://discourse.cmake.org/t/detect-verbose-build-in-a-macro/3296>\
**Category:** Code\
**Created:** [May 11, 2021, 9:09pm UTC](https://discourse.cmake.org/t/detect-verbose-build-in-a-macro/3296 "2021-05-11T21:09:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mathomp4](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mathomp4/32/176_2.png) [@mathomp4](https://discourse.cmake.org/u/mathomp4)\
**Post date:** [May 11, 2021, 9:09pm UTC](https://discourse.cmake.org/t/detect-verbose-build-in-a-macro/3296/1 "2021-05-11T21:09:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [May 11, 2021, 9:11pm UTC](https://discourse.cmake.org/t/detect-verbose-build-in-a-macro/3296/2 "2021-05-11T21:11:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mathomp4](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mathomp4/32/176_2.png) [@mathomp4](https://discourse.cmake.org/u/mathomp4)\
**Post date:** [May 11, 2021, 9:16pm UTC](https://discourse.cmake.org/t/detect-verbose-build-in-a-macro/3296/3 "2021-05-11T21:16:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [May 11, 2021, 10:17pm UTC](https://discourse.cmake.org/t/detect-verbose-build-in-a-macro/3296/4 "2021-05-11T22:17:45Z")

</div>

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.
