gnucash.pot target improvements

- add simple target called 'pot' so translators can run 'make pot'
- make gnucash.pot depend on all files with translatable strings. So whenever
  one of these files is changed the potfile will automatically be regenerated
  (if the current target depends on it, like 'pot' or 'dist')

Note the default target (make without anything) does not depend on gnucash.pot
so the potfile will not automatically be (re)generated when building that target.
This commit is contained in:
Geert Janssens 2018-01-29 21:51:38 +01:00
parent 6e5ac2608b
commit 99ebeb6b5d

View File

@ -114,6 +114,13 @@ FUNCTION(MAKE_GNUCASH_POTFILES)
)
STRING(REPLACE "\n" ";" POTFILES "${POTFILES_IN}")
# These are manually added, because they're not picked up by the generation script
list(APPEND POTFILES
"gnucash/gnome/gnucash.appdata.xml.in"
"gnucash/gnome/gnucash.desktop.in.in"
"libgnucash/engine/qofbookslots.h"
"doc/tip_of_the_day.list.in")
# Write out the final list.
# intltool-update insists that this file be in the source directory. :-(
SET(POTFILES_IN_PATH ${CMAKE_CURRENT_BINARY_DIR}/POTFILES.in)
@ -121,7 +128,9 @@ FUNCTION(MAKE_GNUCASH_POTFILES)
# This file was autogenerated by cmake.
")
set(POTFILE_DEPS "")
FOREACH(path ${POTFILES})
list(APPEND POTFILE_DEPS ${CMAKE_SOURCE_DIR}/${path})
STRING(REGEX MATCH gschema.xml.in.in IS_GSCHEMA ${path})
IF(IS_GSCHEMA)
# Force parse type for gsettings files
@ -130,13 +139,9 @@ FUNCTION(MAKE_GNUCASH_POTFILES)
FILE(APPEND ${POTFILES_IN_PATH} "${path}\n")
ENDFOREACH()
# These are manually added, because they're not picked up by the generation script
FILE(APPEND ${POTFILES_IN_PATH} "gnucash/gnome/gnucash.appdata.xml.in
gnucash/gnome/gnucash.desktop.in.in
libgnucash/engine/qofbookslots.h
doc/tip_of_the_day.list.in
")
CONFIGURE_FILE(${POTFILES_IN_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/POTFILES.in NEWLINE_STYLE LF)
set(gnucash_pot_depends ${POTFILE_DEPS} CACHE INTERNAL "List of files with translatable strings. If any of these change, gnucash.pot should be regenerated")
ENDFUNCTION()
find_program(INTLTOOL_UPDATE NAMES intltool-update)
@ -169,8 +174,10 @@ IF(BUILDING_FROM_VCS)
-D PERL=${PERL_EXECUTABLE}
-D XGETTEXT=${XGETTEXT}
-P ${CMAKE_CURRENT_SOURCE_DIR}/gnucash-pot.cmake
DEPENDS ${gnucash_pot_depends}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
add_custom_target (pot DEPENDS gnucash.pot)
ENDIF()
dist_add_generated(gnucash.pot)