CMAKE_MESSAGE_LOG_LEVEL is unset when --log-level is specified
cmake_minimum_required(VERSION 3.16)
project(proj)
message(DEBUG "this is a debug message")
message("CMAKE_MESSAGE_LOG_LEVEL:${CMAKE_MESSAGE_LOG_LEVEL}")
$ cmake .. --log-level=DEBUG
-- this is a debug message
CMAKE_MESSAGE_LOG_LEVEL:
-- Configuring done
-- Generating done
It would be useful to query the value that was specified via --log-level
even if it does not persist the value in the cache.
The queried value can then be used, for example, to pass an additional -v
option to tools executed by execute_process
.