Files
libprozilla/po/CMakeLists.txt
T
2026-07-14 19:53:39 +02:00

22 lines
852 B
CMake

find_program(MSGFMT_EXECUTABLE msgfmt)
file(GLOB translation_sources CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/*.po")
if(MSGFMT_EXECUTABLE)
foreach(source IN LISTS translation_sources)
get_filename_component(language "${source}" NAME_WE)
set(catalog "${CMAKE_CURRENT_BINARY_DIR}/${language}.mo")
add_custom_command(
OUTPUT "${catalog}"
COMMAND "${MSGFMT_EXECUTABLE}" --check-format -o "${catalog}" "${source}"
DEPENDS "${source}"
VERBATIM)
list(APPEND translation_catalogs "${catalog}")
install(FILES "${catalog}"
DESTINATION "${CMAKE_INSTALL_LOCALEDIR}/${language}/LC_MESSAGES"
RENAME libprozilla.mo)
endforeach()
add_custom_target(libprozilla-translations ALL DEPENDS ${translation_catalogs})
else()
message(WARNING "msgfmt was not found; translations will not be built")
endif()