<table><tr><td style="">daandemeyer 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/D22698">View Revision</a></tr></table><br /><div><div><p>To give an example of how the addition would improve KDE CMake build scripts, let's look at part of Kate's CMake build script.</p>
<p>It currently looks like 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);"># collect the needed source files
set (KATE_LIBRARY_SRCS
kateappadaptor.cpp
kateapp.cpp
kateconfigdialog.cpp
kateconfigplugindialogpage.cpp
katedocmanager.cpp
katefileactions.cpp
katemainwindow.cpp
katepluginmanager.cpp
kateviewmanager.cpp
kateviewspace.cpp
katesavemodifieddialog.cpp
katemwmodonhddialog.cpp
katecolorschemechooser.cpp
katequickopenmodel.cpp
katetabbutton.cpp
katetabbar.cpp
# session
session/katesessionsaction.cpp
session/katesessionmanager.cpp
session/katesessionmanagedialog.cpp
session/katesession.cpp
katemdi.cpp
katerunninginstanceinfo.cpp
katequickopen.cpp
katewaiter.h
)
ki18n_wrap_ui(KATE_LIBRARY_SRCS
ui/sessionconfigwidget.ui
session/katesessionmanagedialog.ui
)
add_library(kdeinit_kate STATIC ${KATE_LIBRARY_SRCS})</pre></div>
<p>If the proposed change is accepted, it could be refactored to the following:</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);">add_library(kdeinit_kate STATIC "")
ki18n_wrap_ui(kdeinit_kate
ui/sessionconfigwidget.ui
session/katesessionmanagedialog.ui
)
target_sources(kdeinit_kate PRIVATE
kateappadaptor.cpp
kateapp.cpp
kateconfigdialog.cpp
kateconfigplugindialogpage.cpp
katedocmanager.cpp
katefileactions.cpp
katemainwindow.cpp
katepluginmanager.cpp
kateviewmanager.cpp
kateviewspace.cpp
katesavemodifieddialog.cpp
katemwmodonhddialog.cpp
katecolorschemechooser.cpp
katequickopenmodel.cpp
katetabbutton.cpp
katetabbar.cpp
# session
session/katesessionsaction.cpp
session/katesessionmanager.cpp
session/katesessionmanagedialog.cpp
session/katesession.cpp
katemdi.cpp
katerunninginstanceinfo.cpp
katequickopen.cpp
katewaiter.h
)</pre></div>
<ul class="remarkup-list">
<li class="remarkup-list-item">We don't need a <tt style="background: #ebebeb; font-size: 13px;">SRCS</tt> variable anymore. Instead, generated files are added directly to the library target using the <tt style="background: #ebebeb; font-size: 13px;">target_sources</tt> command.</li>
<li class="remarkup-list-item">The order commands are called in becomes more intuitive. We can call <tt style="background: #ebebeb; font-size: 13px;">add_library</tt> first, follow with the <tt style="background: #ebebeb; font-size: 13px;">ki18n_wrap_ui</tt> command and end with specifying the long list of source files instead of having to start the script with specifying all source files.</li>
</ul></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D22698">https://phabricator.kde.org/D22698</a></div></div><br /><div><strong>To: </strong>daandemeyer, ilic<br /><strong>Cc: </strong>ltoscano, alexmerry, turbov, cgiboudeaux, kde-frameworks-devel, LeGast00n, sbergeron, michaelh, ngraham, bruns<br /></div>