Commit 38471eeb authored by dt's avatar dt

Fixes: Run cmake to get the version and check for the QtCreator generator

Details:  We don't act on that information yet.
parent db20c44d
......@@ -98,6 +98,30 @@ CMakeSettingsPage::CMakeSettingsPage()
settings->beginGroup("CMakeSettings");
m_cmakeExecutable = settings->value("cmakeExecutable").toString();
settings->endGroup();
updateCachedInformation();
}
void CMakeSettingsPage::updateCachedInformation() const
{
// We find out two things:
// Does this cmake version support a QtCreator generator
// and the version
QFileInfo fi(m_cmakeExecutable);
if (!fi.exists()) {
m_version.clear();
m_supportsQtCreator = false;
}
QProcess cmake;
cmake.start(m_cmakeExecutable, QStringList()<<"--help");
cmake.waitForFinished();
QString response = cmake.readAll();
QRegExp versionRegexp("^cmake version ([*\\d\\.]*)-(|patch (\\d*))(|\\r)\\n");
versionRegexp.indexIn(response);
m_supportsQtCreator = response.contains("QtCreator");
m_version = versionRegexp.cap(1);
if (!versionRegexp.capturedTexts().size()>3)
m_version += "." + versionRegexp.cap(3);
}
QString CMakeSettingsPage::findCmakeExecutable() const
......@@ -144,6 +168,7 @@ void CMakeSettingsPage::saveSettings() const
void CMakeSettingsPage::apply()
{
m_cmakeExecutable = m_pathchooser->path();
updateCachedInformation();
saveSettings();
}
......@@ -157,6 +182,7 @@ QString CMakeSettingsPage::cmakeExecutable() const
if (m_cmakeExecutable.isEmpty()) {
m_cmakeExecutable = findCmakeExecutable();
if (!m_cmakeExecutable.isEmpty()) {
updateCachedInformation();
saveSettings();
}
}
......
......@@ -79,9 +79,12 @@ public:
QString cmakeExecutable() const;
void askUserForCMakeExecutable();
private:
void updateCachedInformation() const;
void saveSettings() const;
QString findCmakeExecutable() const;
mutable QString m_cmakeExecutable;
mutable QString m_version;
mutable bool m_supportsQtCreator;
Core::Utils::PathChooser *m_pathchooser;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment