<table><tr><td style="">turbov added a comment.
</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/D22721">View Revision</a></tr></table><br /><div><div><p>Modern CMake has a recommendation to avoid variables when working w/ targets (google "Variables are fragile").<br />
With a small modification to <tt style="background: #ebebeb; font-size: 13px;">ki18n_wrap_ui</tt> (yeah, another project), it could be possible to replace this:</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">cmake

set(katebacktracebrowserplugin_PART_SRCS
  katebacktracebrowser.cpp
  btparser.cpp
  btfileindexer.cpp
  btdatabase.cpp
)

set(katebacktracebrowserplugin_PART_UI
  btbrowserwidget.ui
  btconfigwidget.ui
)

ki18n_wrap_ui(katebacktracebrowserplugin_PART_SRCS ${katebacktracebrowserplugin_PART_UI})


add_library(katebacktracebrowserplugin MODULE ${katebacktracebrowserplugin_PART_SRCS})</pre></div>

<p>with this:</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">cmake
add_library(
  katebacktracebrowserplugin MODULE 
  katebacktracebrowser.cpp
  btparser.cpp
  btfileindexer.cpp
  btdatabase.cpp
)

ki18n_wrap_ui(
  katebacktracebrowserplugin
  btbrowserwidget.ui
  btconfigwidget.ui
)</pre></div>

<p>the main point is to avoid variables (some of them just one time used) and "make the target declaration the only source of truth" %)</p>

<p><tt style="background: #ebebeb; font-size: 13px;">ki18n_wrap_ui</tt> should learn to accept a target name as the first argument and call <tt style="background: #ebebeb; font-size: 13px;">target_sources(<tgt>...)</tt> to update target sources *directly* instead of storint 'em to a variable. For the backward compatibility it's possible to check the first argument with <tt style="background: #ebebeb; font-size: 13px;">if(TARGET...)</tt> and do the direct update or fallback to the old behaviour (assuming that was a variable name to update) on <tt style="background: #ebebeb; font-size: 13px;">else()</tt>...</p>

<p>If you pending some other CMake related patches and have some spare time *please* add this feature too %)))</p></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D22721">https://phabricator.kde.org/D22721</a></div></div><br /><div><strong>To: </strong>daandemeyer, Kate<br /><strong>Cc: </strong>turbov, asturmlechner, kwrite-devel, domson, michaelh, ngraham, demsking, cullmann, sars, dhaumann<br /></div>