D22721: Clean up Kate addons CMake scripts.
Alex Turbov
noreply at phabricator.kde.org
Wed Jul 24 19:34:25 BST 2019
turbov added a comment.
Modern CMake has a recommendation to avoid variables when working w/ targets (google "Variables are fragile").
With a small modification to `ki18n_wrap_ui` (yeah, another project), it could be possible to replace this:
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})
with this:
cmake
add_library(
katebacktracebrowserplugin MODULE
katebacktracebrowser.cpp
btparser.cpp
btfileindexer.cpp
btdatabase.cpp
)
ki18n_wrap_ui(
katebacktracebrowserplugin
btbrowserwidget.ui
btconfigwidget.ui
)
the main point is to avoid variables (some of them just one time used) and "make the target declaration the only source of truth" %)
`ki18n_wrap_ui` should learn to accept a target name as the first argument and call `target_sources(<tgt>...)` 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 `if(TARGET...)` and do the direct update or fallback to the old behaviour (assuming that was a variable name to update) on `else()`...
If you pending some other CMake related patches and have some spare time *please* add this feature too %)))
REVISION DETAIL
https://phabricator.kde.org/D22721
To: daandemeyer, #kate
Cc: turbov, asturmlechner, kwrite-devel, domson, michaelh, ngraham, demsking, cullmann, sars, dhaumann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kwrite-devel/attachments/20190724/3fea0a42/attachment.html>
More information about the KWrite-Devel
mailing list