22 lines
825 B
CMake
22 lines
825 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}" -o "${catalog}" "${source}"
|
|
DEPENDS "${source}"
|
|
VERBATIM)
|
|
list(APPEND translation_catalogs "${catalog}")
|
|
install(FILES "${catalog}"
|
|
DESTINATION "${CMAKE_INSTALL_LOCALEDIR}/${language}/LC_MESSAGES"
|
|
RENAME prozgui.mo)
|
|
endforeach()
|
|
add_custom_target(prozgui-translations ALL DEPENDS ${translation_catalogs})
|
|
else()
|
|
message(WARNING "msgfmt was not found; translations will not be built")
|
|
endif()
|