Преглед изворни кода

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.
Julian Andres Klode пре 10 година
родитељ
комит
ade5888b41
1 измењених фајлова са 4 додато и 1 уклоњено
  1. 4 1
      CMake/Translations.cmake

+ 4 - 1
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