[cmake-developers] Capturing messages to log files (was: Wrapping functions in CMake)

Brad King brad.king at kitware.com
Wed Jul 15 09:10:45 EDT 2015


On 07/09/2015 01:53 PM, Clifford Yapp wrote:
> Actually, thinking about that, what's really needed is not an
> in-memory log but a way to specify log files, since an unexpected
> crash or exit is not a situation under which such in-memory logs could
> be reliably written to disk.  So it would instead need to be
> CMAKE_STATUS_MESSAGE_LOG, CMAKE_ERROR_MESSAGES_LOG, etc. which would
> hold paths to which messages would be copied before being written to
> stdout/stderr.

These could be defined as GLOBAL properties since there can only
be one.  Internally we already have callback infrastructure to
dispatch where these messages go.  Hooks could be added to check
these properties too.  Or, the property setting logic could have
special handling for these properties to install the needed
callbacks internally.  This approach would avoid opening/closing
the log files over and over.  We could just keep them open all
the time and flush after each write.

-Brad



More information about the cmake-developers mailing list