From 92ddf0c9e20af6158d84db34eeba795061fad1e9 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 15 May 2014 09:47:25 -0400 Subject: cmake-gui: Capture cmSystemTools::Stdout and Stderr Output sent through these APIs is logically part of the CMake process output. Capture it with callbacks and display it in the cmake-gui output window along with other messages. --- Source/QtDialog/QCMake.cxx | 16 ++++++++++++++++ Source/QtDialog/QCMake.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index f2a23bb..b833648 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -36,6 +36,8 @@ QCMake::QCMake(QObject* p) cmSystemTools::DisableRunCommandOutput(); cmSystemTools::SetRunCommandHideConsole(true); cmSystemTools::SetMessageCallback(QCMake::messageCallback, this); + cmSystemTools::SetStdoutCallback(QCMake::stdoutCallback, this); + cmSystemTools::SetStderrCallback(QCMake::stderrCallback, this); this->CMakeInstance = new cmake; this->CMakeInstance->SetCMakeEditCommand( @@ -356,6 +358,20 @@ void QCMake::messageCallback(const char* msg, const char* /*title*/, QCoreApplication::processEvents(); } +void QCMake::stdoutCallback(const char* msg, size_t len, void* cd) +{ + QCMake* self = reinterpret_cast(cd); + emit self->outputMessage(QString::fromLocal8Bit(msg,int(len))); + QCoreApplication::processEvents(); +} + +void QCMake::stderrCallback(const char* msg, size_t len, void* cd) +{ + QCMake* self = reinterpret_cast(cd); + emit self->outputMessage(QString::fromLocal8Bit(msg,int(len))); + QCoreApplication::processEvents(); +} + QString QCMake::binaryDirectory() const { return this->BinaryDirectory; diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h index 8e71ea5..bd82f0d 100644 --- a/Source/QtDialog/QCMake.h +++ b/Source/QtDialog/QCMake.h @@ -138,6 +138,8 @@ protected: static void progressCallback(const char* msg, float percent, void* cd); static void messageCallback(const char* msg, const char* title, bool&, void* cd); + static void stdoutCallback(const char* msg, size_t len, void* cd); + static void stderrCallback(const char* msg, size_t len, void* cd); bool SuppressDevWarnings; bool WarnUninitializedMode; bool WarnUnusedMode; -- cgit v0.12