Some years ago, there was some discussion about introducing a way in CMake to specify a file to use to log a copy of the message() function’s outputs:
Does anyone know if a way to log message() outputs to a file was ever introduced? I’m not seeing anything from the message() documentation online…
I’m not aware of any such capability having been developed since then. If you are on a Unix-based platform though, you should be able to use
tee and pipe your output through that to get a similar end result. It would have the added benefit of also capturing output from any
external_process() call too, not just
It’s a good thought - thanks for that - but unfortunately the design goal is to capture all output from the CMake configure process in a log file automatically (i.e. without users having to do anything special) across all platforms so we can’t depend on Unix specific tools.
(Our message() wrapper does the job now, so we do have a solution, but it’s using the discouraged wrap-the-existing-function trick…)
I use a similar work-around, and would also appreciate a more fully-featured message(). For now, the work-around does appear to be quite robust.