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.
This commit is contained in:
Brad King 2014-05-15 09:47:25 -04:00
parent f52b5ae3c4
commit 92ddf0c9e2
2 changed files with 18 additions and 0 deletions

View File

@ -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<QCMake*>(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<QCMake*>(cd);
emit self->outputMessage(QString::fromLocal8Bit(msg,int(len)));
QCoreApplication::processEvents();
}
QString QCMake::binaryDirectory() const
{
return this->BinaryDirectory;

View File

@ -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;