<table><tr><td style="">antonanikin created this revision.<br />antonanikin added a reviewer: KDevelop.<br />antonanikin added a subscriber: kdevelop-devel.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D4079" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>This patch fixes wrong CMake arguments during adding new build directory by user.</p>

<p>Reproducible - always. Steps to reproduce:</p>

<ol class="remarkup-list">
<li class="remarkup-list-item">Open some CMake-based project and go to it's configuration.</li>
<li class="remarkup-list-item">Open CMake settings.</li>
<li class="remarkup-list-item">Press "Show Advanced" button.</li>
<li class="remarkup-list-item">Press button to add new build directory.</li>
<li class="remarkup-list-item">Change some parameters, for example build type to <tt style="background: #ebebeb; font-size: 13px;">MinSizeRel</tt>.</li>
<li class="remarkup-list-item">Press "OK".</li>
<li class="remarkup-list-item">Selected parameters will be "dropped" and replaced by it's default values. For example build type always set to <tt style="background: #ebebeb; font-size: 13px;">Release</tt>.</li>
</ol>

<p>As a result user can't set any CMake parameters for new build directory - all new directories will be "Release" build with default settings.</p>

<p>This caused by wrong order in the <tt style="background: #ebebeb; font-size: 13px;">CMakePreferences::createBuildDir()</tt> method: it's first adds new directory into combo box and then save parameters values to config. But adding directory to the combo box leads to calling <tt style="background: #ebebeb; font-size: 13px;">CMakePreferences::buildDirChanged()</tt> method, which will try to read not yet populated config.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Tested on master branch.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R32 KDevelop</div></div></div><br /><div><strong>BRANCH</strong><div><div>master</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D4079" rel="noreferrer">https://phabricator.kde.org/D4079</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>projectmanagers/cmake/settings/cmakepreferences.cpp</div></div></div><br /><div><strong>EMAIL PREFERENCES</strong><div><a href="https://phabricator.kde.org/settings/panel/emailpreferences/" rel="noreferrer">https://phabricator.kde.org/settings/panel/emailpreferences/</a></div></div><br /><div><strong>To: </strong>antonanikin, KDevelop<br /><strong>Cc: </strong>kdevelop-devel<br /></div>