[geary/wip/771643-replace-intltool] Re-enable top level cmake/Makefile "pot_file" target for po/geary.pot.



commit 813b1085b3cda9c2c8556f7579490b05ec8dbd14
Author: Michael James Gratton <mike vee net>
Date:   Thu Oct 26 16:07:49 2017 +1100

    Re-enable top level cmake/Makefile "pot_file" target for po/geary.pot.

 Makefile.in              |    2 +-
 cmake/FindXGettext.cmake |   29 ++++++++++++++++++++++++++++-
 po/CMakeLists.txt        |   12 ++++++++++--
 3 files changed, 39 insertions(+), 4 deletions(-)
---
diff --git a/Makefile.in b/Makefile.in
index 61a9730..7d4b808 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -24,7 +24,7 @@ uninstall:
 .PHONY: pot_file
 pot_file:
        @$(MAKE) -C $(BUILD_DIR) $@
-       @cp build/src/geary.pot po
+       @cp build/po/geary.pot po
 
 .PHONY: clean
 clean:
diff --git a/cmake/FindXGettext.cmake b/cmake/FindXGettext.cmake
index c6437f8..a490d7e 100644
--- a/cmake/FindXGettext.cmake
+++ b/cmake/FindXGettext.cmake
@@ -27,7 +27,6 @@
 # Macros:
 # GETTEXT_CREATE_POT(potFile
 #    [OPTION xgettext_options]
-#    SRC list_of_source_file_that_contains_msgid
 # )
 #
 # Generate .pot file.
@@ -94,6 +93,34 @@ ENDIF(NOT DEFINED XGETTEXT_OPTIONS)
 
 # Add translations target
 IF(XGETTEXT_FOUND)
+    MACRO(GETTEXT_CREATE_POT _potFile _pot_options )
+        SET(_xgettext_options_list)
+        SET(_src_list)
+        SET(_src_list_abs)
+        FOREACH(_pot_option ${_pot_options} ${ARGN})
+            IF(_pot_option STREQUAL "OPTION")
+                SET(_stage "OPTION")
+            ELSE(_pot_option STREQUAL "OPTION")
+                IF(_stage STREQUAL "OPTION")
+                    SET(_xgettext_options_list ${_xgettext_options_list} ${_pot_option})
+                ENDIF(_stage STREQUAL "OPTION")
+            ENDIF(_pot_option STREQUAL "OPTION")
+        ENDFOREACH(_pot_option ${_pot_options} ${ARGN})
+
+        IF (_xgettext_options_list)
+            SET(_xgettext_options ${_xgettext_options_list})
+        ELSE(_xgettext_options_list)
+            SET(_xgettext_options ${XGETTEXT_OPTIONS})
+        ENDIF(_xgettext_options_list)
+
+        ADD_CUSTOM_TARGET(pot_file
+            COMMAND ${XGETTEXT_EXECUTABLE} ${_xgettext_options_list} -f po/POTFILES.in -o 
${CMAKE_CURRENT_BINARY_DIR}/${_potFile}
+            DEPENDS "POTFILES.in"
+            WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+            COMMENT "Extract translatable messages to ${_potFile}"
+        )
+    ENDMACRO(GETTEXT_CREATE_POT _potFile _pot_options)
+
     MACRO(GETTEXT_CREATE_TRANSLATIONS _firstLang)
         SET(_gmoFiles)
         SET(_addToAll)
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
index 69ba600..0f3db85 100644
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@ -2,9 +2,17 @@
 file(STRINGS "LINGUAS" TRANSLATED)
 
 IF (XGETTEXT_FOUND)
+    GETTEXT_CREATE_POT(geary.pot
+        OPTION
+        # XXX Keep these in sync with Makevars
+        --from-code=UTF-8
+        --add-comments
+        --keyword=C_:1c,2
+        --keyword=NC_:1c,2
+    )
     GETTEXT_CREATE_TRANSLATIONS(ALL ${TRANSLATED}
-           COMMENT "Creating translations.")
+        COMMENT "Creating translations."
+    )
 ELSE ()
     message(STATUS "xgettext not found")
 ENDIF()
-


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]