How to see "message(VERBOSE ...)" output?

According to https://cmake.org/cmake/help/latest/command/message.html I can use message(VERBOSE "some text") to log “Detailed informational messages intended for project users”. But somehow I can’t manage to get these messages to display.

What I’ve tried so far:

  • cmake -v ..
  • cmake --verbose=3 ..
  • cmake -DVERBOSE=1 ..
  • env VERBOSE=1 cmake ..
  • cmake --debug-output .. (this gives way too much output, but my verbose messages are still not shown)

What options or settings do I need to use to see these messages that are logged with mode “VERBOSE”? I’m using CMake 3.17 under RHEL 7.

Thanks, Oliver

1 Like

The answer is right there on the linked site:

The --log-level command-line option to each of these tools can be used to control which messages will be shown. To make a log level persist between CMake runs, the CMAKE_MESSAGE_LOG_LEVEL variable can be set instead. Note that the command line option takes precedence over the cache variable.

1 Like

Huh, thanks a lot! Somehow I missed the --log-level command line option.

I tried installing CMake 3.17.3 and call it with --log-level=TRACE and --log-level=VERBOSE, but the messages never showed up. In the end, after waiting an hour with this, I figured out the best of the best is just to use an if defined checking if VERBOSE environment variable is defined:

if (DEFINED ENV{VERBOSE})
    MESSAGE(STATUS "Doing message for debug")
endif()