MCPcopy Create free account
hub / github.com/KDE/kdevelop / cmakeExecutableVersion

Function cmakeExecutableVersion

plugins/cmake/cmakeutils.cpp:288–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286}
287
288QString cmakeExecutableVersion(const QString& cmakeExecutable)
289{
290 QProcess p;
291 p.setProcessChannelMode(QProcess::ForwardedErrorChannel);
292 p.start(cmakeExecutable, {QStringLiteral("--version")});
293 if (!p.waitForFinished()) {
294 qCWarning(CMAKE) << "failed to read cmake version for executable" << cmakeExecutable << p.errorString();
295 return {};
296 }
297
298 static const QRegularExpression pattern(QStringLiteral("cmake version (\\d\\.\\d+(?:\\.\\d+)?).*"));
299 const auto output = QString::fromLocal8Bit(p.readAll());
300 const auto match = pattern.match(output);
301 if (!match.hasMatch()) {
302 qCWarning(CMAKE) << "failed to read cmake version for executable" << cmakeExecutable << output;
303 return {};
304 }
305
306 const auto version = match.captured(1);
307 qCDebug(CMAKE) << "cmake version for executable" << cmakeExecutable << version;
308 return version;
309}
310
311KDevelop::Path currentCMakeExecutable(KDevelop::IProject* project, int builddir)
312{

Callers 2

supportedFunction · 0.85
initTestCaseMethod · 0.85

Calls 4

hasMatchMethod · 0.80
startMethod · 0.45
errorStringMethod · 0.45
matchMethod · 0.45

Tested by 1

initTestCaseMethod · 0.68