From ade5888b4107f3181abd2a7dd15d8b2b4a997f82 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 19 Aug 2016 15:52:14 +0200 Subject: CMake: Translations: Don't rebuild .mo for line number changes If only the line numbers changed in a file without any of the translatable strings changing, the .po and .mo files were rebuilt, making building simple code changes somewhat annoying. We can work around this by passing --add-location=file to msgcomm when we are creating the temporary .pot file used for building the .mo files. --- CMake/Translations.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'CMake') diff --git a/CMake/Translations.cmake b/CMake/Translations.cmake index 509e4e378..d7e992b3e 100644 --- a/CMake/Translations.cmake +++ b/CMake/Translations.cmake @@ -67,13 +67,16 @@ function(apt_add_translation_domain) # build a ${domain.pot}-tmp as a byproduct. The msgfmt command than depend # on the byproduct while their target depends on the output, so that msgfmt # does not have to be rerun if nothing in the template changed. + # + # Make sure the .pot-tmp has no line numbers, to avoid useless rebuilding + # of .mo files. add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${domain}.pot BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/${domain}.pot-tmp COMMAND msgcomm --more-than=0 --sort-by-file ${sh_pot} ${CMAKE_CURRENT_BINARY_DIR}/${domain}.c.pot --output=${CMAKE_CURRENT_BINARY_DIR}/${domain}.pot - COMMAND msgcomm --more-than=0 --omit-header --sort-by-file + COMMAND msgcomm --more-than=0 --omit-header --sort-by-file --add-location=file ${sh_pot} ${CMAKE_CURRENT_BINARY_DIR}/${domain}.c.pot --output=${CMAKE_CURRENT_BINARY_DIR}/${domain}.pot-tmp0 -- cgit v1.2.3-18-g5258