SUMMARY Building projects that have the `ki18n_install(po)` line in CMakeLists.txt, such as KDevelop, kio-extras and ki18n itself, always produces output like this, even if nothing has changed: [2/2] Generating ts... [2/2] Generating mo... Commenting out the `ki18n_install(po)` line works the issue around. A nothing-changed KDevelop build takes 8 seconds with the `ki18n_install(po)` line and less than a second without it: $ ninja ninja: no work to do. Debug output when the `ki18n_install(po)` line is present: $ ninja -d explain ninja explain: output CMakeFiles/pofiles-1ce71fd1ec78d5566f158140586603a7 doesn't exist ninja explain: CMakeFiles/pofiles-1ce71fd1ec78d5566f158140586603a7 is dirty ninja explain: pofiles-1ce71fd1ec78d5566f158140586603a7 is dirty ninja explain: output CMakeFiles/tsfiles-1ce71fd1ec78d5566f158140586603a7 doesn't exist ninja explain: CMakeFiles/tsfiles-1ce71fd1ec78d5566f158140586603a7 is dirty ninja explain: tsfiles-1ce71fd1ec78d5566f158140586603a7 is dirty The same issue occurs when the Makefile generator is used: $ make [ 1%] Generating mo... [ 1%] Built target pofiles-1ce71fd1ec78d5566f158140586603a7 [ 2%] Generating ts... SOFTWARE/OS VERSIONS Manjaro GNU/Linux, Xfce, X11 KDE Frameworks Version: 5.98 Qt Version: 5.15.6+kde ADDITIONAL INFORMATION See also https://invent.kde.org/kdevelop/kdevelop/-/issues/13
the issue is that it's using `add_custom_target` which is always dirty. in practice, `add_custom_target` should basically never be used imo - it would be much better to rewrite this to leverage `add_custom_command` instead, such that dependencies can be properly tracked. but that would require us to pass a target along to the macro that can be associated with the command - otherwise it would never be build. a pity that one cannot use `ALL` for `add_custom_command` :( very nasty, I wonder why no-one else complained about this yet :)
(In reply to Milian Wolff from comment #1) > very nasty, I wonder why no-one else complained about this yet :) Maybe because the po files were committed to the main repositories only about two weeks ago. And the build slowdown of most projects is much less than 8 seconds.
https://discourse.cmake.org/t/feature-request-add-custom-command-all/7609 Let's see what the cmake wizards have to say to this
(In reply to Milian Wolff from comment #3) > https://discourse.cmake.org/t/feature-request-add-custom-command-all/7609 > > Let's see what the cmake wizards have to say to this The proposed solution is: > add_custom_command(OUTPUT file.txt COMMAND ${CMAKE_COMMAND} -E touch file.txt) > add_custom_target(tgt ALL DEPENDS file.txt) Questions: 1. Is it possible/how to enumerate all OUTPUT files in the CMake command? 2. Would the translations be updated after a *.po file is modified?