diff --git a/src/plugins/projectexplorer/makestep.cpp b/src/plugins/projectexplorer/makestep.cpp index 91cbfc43516..7bfcc0655be 100644 --- a/src/plugins/projectexplorer/makestep.cpp +++ b/src/plugins/projectexplorer/makestep.cpp @@ -375,6 +375,15 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep) m_ui = new Internal::Ui::MakeStep; m_ui->setupUi(this); + if (!makeStep->disablingForSubdirsSupported()) { + m_ui->disableInSubDirsLabel->hide(); + m_ui->disableInSubDirsCheckBox->hide(); + } else { + connect(m_ui->disableInSubDirsCheckBox, &QCheckBox::toggled, this, [this] { + m_makeStep->setEnabledForSubDirs(!m_ui->disableInSubDirsCheckBox->isChecked()); + }); + } + const auto availableTargets = makeStep->availableTargets(); for (const QString &target : availableTargets) { auto item = new QListWidgetItem(target, m_ui->targetsList); @@ -472,6 +481,7 @@ void MakeStepConfigWidget::updateDetails() m_makeStep->jobCountOverridesMakeflags() ? Qt::Checked : Qt::Unchecked); m_ui->nonOverrideWarning->setVisible(m_makeStep->makeflagsJobCountMismatch() && !m_makeStep->jobCountOverridesMakeflags()); + m_ui->disableInSubDirsCheckBox->setChecked(!m_makeStep->enabledForSubDirs()); ProcessParameters param; param.setMacroExpander(bc->macroExpander()); diff --git a/src/plugins/projectexplorer/makestep.h b/src/plugins/projectexplorer/makestep.h index 9bde1c41a41..11cfb51bc3e 100644 --- a/src/plugins/projectexplorer/makestep.h +++ b/src/plugins/projectexplorer/makestep.h @@ -79,10 +79,15 @@ public: bool userArgsContainsJobCount() const; bool makeflagsJobCountMismatch() const; + bool disablingForSubdirsSupported() const { return m_disablingForSubDirsSupported; } + bool enabledForSubDirs() const { return m_enabledForSubDirs; } + void setEnabledForSubDirs(bool enabled) { m_enabledForSubDirs = enabled; } + Utils::Environment environment(BuildConfiguration *bc) const; protected: bool fromMap(const QVariantMap &map) override; + void supportDisablingForSubdirs() { m_disablingForSubDirsSupported = true; } private: QVariantMap toMap() const override; @@ -96,6 +101,8 @@ private: int m_userJobCount = 4; bool m_overrideMakeflags = false; bool m_clean = false; + bool m_disablingForSubDirsSupported = false; + bool m_enabledForSubDirs = true; }; class PROJECTEXPLORER_EXPORT MakeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget diff --git a/src/plugins/projectexplorer/makestep.ui b/src/plugins/projectexplorer/makestep.ui index b6ddcc68972..94f55738da5 100644 --- a/src/plugins/projectexplorer/makestep.ui +++ b/src/plugins/projectexplorer/makestep.ui @@ -6,7 +6,7 @@ 0 0 - 399 + 422 279 @@ -59,7 +59,7 @@ - + Targets: @@ -69,7 +69,7 @@ - + @@ -100,6 +100,23 @@ + + + + + + + Disable in subdirectories: + + + + + + + Runs this step only for a top-level build. + + + diff --git a/src/plugins/qmakeprojectmanager/qmakemakestep.cpp b/src/plugins/qmakeprojectmanager/qmakemakestep.cpp index ec318b63e63..140ec975023 100644 --- a/src/plugins/qmakeprojectmanager/qmakemakestep.cpp +++ b/src/plugins/qmakeprojectmanager/qmakemakestep.cpp @@ -60,6 +60,7 @@ QmakeMakeStep::QmakeMakeStep(BuildStepList *bsl) setClean(true); setUserArguments("clean"); } + supportDisablingForSubdirs(); } bool QmakeMakeStep::init() @@ -79,8 +80,7 @@ bool QmakeMakeStep::init() } // Ignore all but the first make step for a non-top-level build. See QTCREATORBUG-15794. - m_ignoredNonTopLevelBuild = (bc->fileNodeBuild() || bc->subNodeBuild()) - && stepList()->firstOfType() != this; + m_ignoredNonTopLevelBuild = (bc->fileNodeBuild() || bc->subNodeBuild()) && !enabledForSubDirs(); ProcessParameters *pp = processParameters(); pp->setMacroExpander(bc->macroExpander());