epubgrep/translations/CMakeLists.txt

35 lines
926 B
CMake

set(potfile "${PROJECT_SOURCE_DIR}/translations/${PROJECT_NAME}.pot")
if(GENERATE_POT)
file(GLOB po_src_files "../src/*pp")
add_custom_command(OUTPUT ${potfile}
COMMAND "${XGETTEXT_CMD}"
"--language=C++"
"--keyword=translate:1,1t"
"--keyword=translate:1c,2,2t"
"--keyword=translate:1,2,3t"
"--keyword=translate:1c,2,3,4t"
"--package-name=${PROJECT_NAME}"
"--package-version=${PROJECT_VERSION}"
"--from-code=utf-8"
"--foreign-user"
"--output=${potfile}"
${po_src_files}
DEPENDS "${po_src_files}"
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
COMMENT "Extract translatable messages to ${potfile}")
add_custom_target(${PROJECT_NAME}_pot
ALL DEPENDS ${potfile})
unset(po_src_files)
endif(GENERATE_POT)
file(GLOB po_files "*.po")
# Creates install target automatically.
GETTEXT_CREATE_TRANSLATIONS(${potfile} ALL ${po_files})
unset(po_files)
unset(potfile)