Fix compile and link problem with song database being turned into a plugin but still...
[kworship.git] / po / CMakeLists.txt
blob921d0858ebedf01e5fd7500f97e3461c4e482391
1 FIND_PACKAGE(KDE4 REQUIRED)
3 FIND_PROGRAM(GETTEXT_MSGFMT_EXECUTABLE msgfmt)
5 IF(NOT GETTEXT_MSGFMT_EXECUTABLE)
6   MESSAGE(
7 "------
8 NOTE: msgfmt not found. Translations will *not* be installed
9 ------")
11 ELSE(NOT GETTEXT_MSGFMT_EXECUTABLE)
12   SET(catalogname kworship)
14   ADD_CUSTOM_TARGET(translations ALL)
16   FILE(GLOB PO_FILES ${catalogname}*.po)
18   FOREACH(_poFile ${PO_FILES})
19     GET_FILENAME_COMPONENT(_poFileName ${_poFile} NAME)
20     STRING(REGEX REPLACE "^${catalogname}_?" "" _langCode ${_poFileName} )
21     STRING(REGEX REPLACE "\\.po$" "" _langCode ${_langCode} )
23     IF( _langCode )
24       GET_FILENAME_COMPONENT(_lang ${_poFile} NAME_WE)
25       SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
27       ADD_CUSTOM_COMMAND(TARGET translations
28           COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_poFile}
29           DEPENDS ${_poFile})
30       INSTALL(FILES ${_gmoFile} DESTINATION ${LOCALE_INSTALL_DIR}/${_langCode}/LC_MESSAGES/ RENAME ${catalogname}.mo)
31     ENDIF( _langCode )
33   ENDFOREACH(_poFile ${PO_FILES})
35 ENDIF(NOT GETTEXT_MSGFMT_EXECUTABLE)