forked from qt-creator/qt-creator
Fixes: Run cmake to get the version and check for the QtCreator generator
Details: We don't act on that information yet.
This commit is contained in:
@@ -98,6 +98,30 @@ CMakeSettingsPage::CMakeSettingsPage()
|
|||||||
settings->beginGroup("CMakeSettings");
|
settings->beginGroup("CMakeSettings");
|
||||||
m_cmakeExecutable = settings->value("cmakeExecutable").toString();
|
m_cmakeExecutable = settings->value("cmakeExecutable").toString();
|
||||||
settings->endGroup();
|
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
|
QString CMakeSettingsPage::findCmakeExecutable() const
|
||||||
@@ -144,6 +168,7 @@ void CMakeSettingsPage::saveSettings() const
|
|||||||
void CMakeSettingsPage::apply()
|
void CMakeSettingsPage::apply()
|
||||||
{
|
{
|
||||||
m_cmakeExecutable = m_pathchooser->path();
|
m_cmakeExecutable = m_pathchooser->path();
|
||||||
|
updateCachedInformation();
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,6 +182,7 @@ QString CMakeSettingsPage::cmakeExecutable() const
|
|||||||
if (m_cmakeExecutable.isEmpty()) {
|
if (m_cmakeExecutable.isEmpty()) {
|
||||||
m_cmakeExecutable = findCmakeExecutable();
|
m_cmakeExecutable = findCmakeExecutable();
|
||||||
if (!m_cmakeExecutable.isEmpty()) {
|
if (!m_cmakeExecutable.isEmpty()) {
|
||||||
|
updateCachedInformation();
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -79,9 +79,12 @@ public:
|
|||||||
QString cmakeExecutable() const;
|
QString cmakeExecutable() const;
|
||||||
void askUserForCMakeExecutable();
|
void askUserForCMakeExecutable();
|
||||||
private:
|
private:
|
||||||
|
void updateCachedInformation() const;
|
||||||
void saveSettings() const;
|
void saveSettings() const;
|
||||||
QString findCmakeExecutable() const;
|
QString findCmakeExecutable() const;
|
||||||
mutable QString m_cmakeExecutable;
|
mutable QString m_cmakeExecutable;
|
||||||
|
mutable QString m_version;
|
||||||
|
mutable bool m_supportsQtCreator;
|
||||||
Core::Utils::PathChooser *m_pathchooser;
|
Core::Utils::PathChooser *m_pathchooser;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user