forked from qt-creator/qt-creator
CMakePM: Ask for configuration save if the user has changed variables
If the use has forgotten to click "Apply Configuration Changes" button in project settings but it tries to build or run the project, then the "Apply Configuration Changes" dialog box pops as a reminder. Change-Id: I26728ee3c79af72125be3bede759620c2cf3d7a1 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -284,8 +284,7 @@ void CMakeBuildSystem::triggerParsing()
|
||||
}
|
||||
|
||||
if ((0 == (reparseParameters & REPARSE_FORCE_EXTRA_CONFIGURATION))
|
||||
&& !m_parameters.extraCMakeArguments.isEmpty()) {
|
||||
if (mustApplyExtraArguments())
|
||||
&& mustApplyExtraArguments(m_parameters)) {
|
||||
reparseParameters |= REPARSE_FORCE_CMAKE_RUN | REPARSE_FORCE_EXTRA_CONFIGURATION;
|
||||
}
|
||||
|
||||
@@ -438,15 +437,15 @@ void CMakeBuildSystem::setParametersAndRequestParse(const BuildDirParameters &pa
|
||||
}
|
||||
}
|
||||
|
||||
bool CMakeBuildSystem::mustApplyExtraArguments() const
|
||||
bool CMakeBuildSystem::mustApplyExtraArguments(const BuildDirParameters ¶meters) const
|
||||
{
|
||||
if (m_parameters.extraCMakeArguments.isEmpty())
|
||||
if (parameters.extraCMakeArguments.isEmpty())
|
||||
return false;
|
||||
|
||||
auto answer = QMessageBox::question(Core::ICore::mainWindow(),
|
||||
tr("Apply configuration changes?"),
|
||||
tr("Run CMake with \"%1\"?")
|
||||
.arg(m_parameters.extraCMakeArguments.join(" ")),
|
||||
.arg(parameters.extraCMakeArguments.join(" ")),
|
||||
QMessageBox::Apply | QMessageBox::Discard,
|
||||
QMessageBox::Apply);
|
||||
return answer == QMessageBox::Apply;
|
||||
@@ -506,12 +505,10 @@ bool CMakeBuildSystem::persistCMakeState()
|
||||
qCDebug(cmakeBuildSystemLog) << "Checking whether build system needs to be persisted:"
|
||||
<< "workdir:" << parameters.workDirectory
|
||||
<< "buildDir:" << parameters.buildDirectory
|
||||
<< "Has extraargs:" << !parameters.extraCMakeArguments.isEmpty()
|
||||
<< "must apply extra Args:"
|
||||
<< mustApplyExtraArguments();
|
||||
<< "Has extraargs:" << !parameters.extraCMakeArguments.isEmpty();
|
||||
|
||||
if (parameters.workDirectory == parameters.buildDirectory
|
||||
&& !parameters.extraCMakeArguments.isEmpty() && mustApplyExtraArguments()) {
|
||||
&& mustApplyExtraArguments(parameters)) {
|
||||
reparseFlags = REPARSE_FORCE_EXTRA_CONFIGURATION;
|
||||
qCDebug(cmakeBuildSystemLog) << " -> must run CMake with extra arguments.";
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ private:
|
||||
void setParametersAndRequestParse(const BuildDirParameters ¶meters,
|
||||
const int reparseParameters);
|
||||
|
||||
bool mustApplyExtraArguments() const;
|
||||
bool mustApplyExtraArguments(const BuildDirParameters ¶meters) const;
|
||||
|
||||
// State handling:
|
||||
// Parser states:
|
||||
|
||||
Reference in New Issue
Block a user