gnucash/po/gnucash-pot.cmake
Geert Janssens d8a304c2c9 Housekeeping - reduce the number of PACKAGE and VERSION related cmake variables
This starts by setting the gnucash version number in the 'project' call.
This will result in a number of variables set by cmake. The remainder
of this commit is to reuse the auto-generated
PROJECT_NAME, PROJECT_VERSION, PROJECT_VERSION_MAJOR
PROJECT_VERSION_MINOR, PROJECT_VERSION_PATCH and PROJECT_VERSION_TWEAK
instead of all the various instances of PACKAGE, GNUCASH_MAJOR_VERSION
and so on.

One parameter is worth mentioning - GETTEXT_PACKAGE
GnuCash is not using this directly (any more) but it has to be set before
including gi18n-lib.h.
2020-01-17 18:15:27 +01:00

45 lines
2.1 KiB
CMake

execute_process(
COMMAND ${XGETTEXT} --add-comments=Translators
--directory=${TOP_SRC_DIR}
--default-domain=${PROJECT_NAME}
--output=${PROJECT_NAME}.pot
--files-from=${PO_SRC_DIR}/POTFILES.in
--from-code=UTF-8
--flag=g_strdup_printf:1:c-format
--flag=g_string_printf:2:c-format
--flag=g_string_append_printf:2:c-format
--flag=g_error_new:3:c-format
--flag=g_set_error:4:c-format
--flag=g_markup_printf_escaped:1:c-format
--flag=g_log:3:c-format
--flag=g_print:1:c-format
--flag=g_printerr:1:c-format
--flag=g_printf:1:c-format
--flag=g_fprintf:2:c-format
--flag=g_sprintf:2:c-format
--flag=g_snprintf:3:c-format
--flag=g_scanner_error:2:c-format
--flag=g_scanner_warn:2:c-format
--keyword=_
--keyword=Q_:1g
--keyword=N_
--keyword=C_:1c,2
--keyword=NC_:1c,2
--keyword=translate:1,1t
--keyword=translate:1c,2,2t
--keyword=translate:1,2,3t
--keyword=translate:1c,2,3,4t
--package-name=${PACKAGE_NAME}
--package-version=${PROJECT_VERSION}
--msgid-bugs-address=https://bugs.gnucash.org/enter_bug.cgi?product=GnuCash&component=Translations
WORKING_DIRECTORY ${PO_BIN_DIR}
RESULT_VARIABLE GNUCASH_POT_RESULT
)
if (NOT ${GNUCASH_POT_RESULT} STREQUAL "0")
message(FATAL_ERROR "Error when creating gnucash.pot: ${GNUCASH_POT_RESULT}")
endif()
if (NOT EXISTS ${PO_BIN_DIR}/gnucash.pot)
message(FATAL_ERROR "POT file '${PO_BIN_DIR}/gnucash.pot' was not successfully created.")
endif()