aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cmakeprojectmanager/cmakeprocess.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/cmakeprojectmanager/cmakeprocess.cpp')
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeprocess.cpp34
1 files changed, 6 insertions, 28 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakeprocess.cpp b/src/plugins/cmakeprojectmanager/cmakeprocess.cpp
index 2c603d7331..ba6b582896 100644
--- a/src/plugins/cmakeprojectmanager/cmakeprocess.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeprocess.cpp
@@ -33,14 +33,9 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/taskhub.h>
-#include <utils/algorithm.h>
-#include <utils/fileutils.h>
#include <utils/stringutils.h>
#include <QDir>
-#include <QObject>
-#include <QTime>
-#include <QTimer>
namespace CMakeProjectManager {
namespace Internal {
@@ -76,9 +71,7 @@ CMakeProcess::~CMakeProcess()
Core::Reaper::reap(m_process.release());
}
- // Delete issue parser:
- if (m_parser)
- m_parser->flush();
+ m_parser.flush();
if (m_future) {
reportCanceled();
@@ -88,7 +81,7 @@ CMakeProcess::~CMakeProcess()
void CMakeProcess::run(const BuildDirParameters &parameters, const QStringList &arguments)
{
- QTC_ASSERT(!m_process && !m_parser && !m_future, return);
+ QTC_ASSERT(!m_process && !m_future, return);
CMakeTool *cmake = parameters.cmakeTool();
QTC_ASSERT(parameters.isValid() && cmake, return);
@@ -98,19 +91,9 @@ void CMakeProcess::run(const BuildDirParameters &parameters, const QStringList &
const QString srcDir = parameters.sourceDirectory.toString();
- auto parser = std::make_unique<CMakeParser>();
+ const auto parser = new CMakeParser;
parser->setSourceDirectory(srcDir);
- QDir source = QDir(srcDir);
- connect(parser.get(), &IOutputParser::addTask, parser.get(),
- [source](const Task &task) {
- if (task.file.isEmpty() || task.file.toFileInfo().isAbsolute()) {
- TaskHub::addTask(task);
- } else {
- Task t = task;
- t.file = Utils::FilePath::fromString(source.absoluteFilePath(task.file.toString()));
- TaskHub::addTask(t);
- }
- });
+ m_parser.addLineParser(parser);
// Always use the sourceDir: If we are triggered because the build directory is getting deleted
// then we are racing against CMakeCache.txt also getting deleted.
@@ -130,11 +113,7 @@ void CMakeProcess::run(const BuildDirParameters &parameters, const QStringList &
connect(process.get(), QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
this, &CMakeProcess::handleProcessFinished);
- QStringList args;
- args += parameters.generatorArguments;
- args += arguments;
- args += srcDir;
- Utils::CommandLine commandLine(cmake->cmakeExecutable(), args);
+ Utils::CommandLine commandLine(cmake->cmakeExecutable(), QStringList({"-S", srcDir, QString("-B"), workDirectory.toString()}) + arguments);
TaskHub::clearTasks(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
@@ -155,7 +134,6 @@ void CMakeProcess::run(const BuildDirParameters &parameters, const QStringList &
process->start();
m_process = std::move(process);
- m_parser = std::move(parser);
m_future = std::move(future);
}
@@ -201,7 +179,7 @@ void CMakeProcess::processStandardError()
static QString rest;
rest = lineSplit(rest, m_process->readAllStandardError(), [this](const QString &s) {
- m_parser->stdError(s);
+ m_parser.appendMessage(s, Utils::StdErrFormat);
Core::MessageManager::write(s);
});
}