tastytea
11a8989370
All checks were successful
continuous-integration/drone/push Build is passing
Caveats: <https://cmake.org/cmake/help/latest/command/file.html#filesystem>
39 lines
1.2 KiB
CMake
39 lines
1.2 KiB
CMake
set(potfile "${PROJECT_SOURCE_DIR}/translations/${PROJECT_NAME}.pot")
|
|
file(GLOB po_src_files CONFIGURE_DEPENDS "../src/*pp")
|
|
file(GLOB po_src_files_relative CONFIGURE_DEPENDS
|
|
RELATIVE "${PROJECT_SOURCE_DIR}" "../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_relative}
|
|
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)
|
|
unset(po_src_files_relative)
|
|
|
|
file(GLOB po_files CONFIGURE_DEPENDS "*.po")
|
|
|
|
# Hack to prevent GETTEXT_CREATE_TRANSLATIONS from updating the .po files.
|
|
set(backup_GETTEXT_MSGMERGE_EXECUTABLE ${GETTEXT_MSGMERGE_EXECUTABLE})
|
|
set(GETTEXT_MSGMERGE_EXECUTABLE "true")
|
|
# Creates install target automatically.
|
|
GETTEXT_CREATE_TRANSLATIONS(${potfile} ALL ${po_files})
|
|
set(GETTEXT_MSGMERGE_EXECUTABLE ${backup_GETTEXT_MSGMERGE_EXECUTABLE})
|
|
|
|
unset(po_files)
|
|
unset(potfile)
|