]> git.saurik.com Git - apt.git/commitdiff
CMake: Translations: Don't rebuild .mo for line number changes
authorJulian Andres Klode <jak@debian.org>
Fri, 19 Aug 2016 13:52:14 +0000 (15:52 +0200)
committerJulian Andres Klode <jak@debian.org>
Fri, 19 Aug 2016 13:54:25 +0000 (15:54 +0200)
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

index 509e4e378466060897c87ca9fdc41b1a786d8d65..d7e992b3e83f24b1e204d7151410699342cfea82 100644 (file)
@@ -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