summaryrefslogtreecommitdiff
path: root/po/CMakeLists.txt
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-01-02 01:48:38 +0200
committerAndrei Karas <akaras@inbox.ru>2011-01-02 02:41:24 +0200
commit3eeae12c498d1a4dbe969462d2ba841f77ee3ccb (patch)
treeff8eab35e732bc0749fc11677c8873a7b3a58704 /po/CMakeLists.txt
downloadplus-3eeae12c498d1a4dbe969462d2ba841f77ee3ccb.tar.gz
plus-3eeae12c498d1a4dbe969462d2ba841f77ee3ccb.tar.bz2
plus-3eeae12c498d1a4dbe969462d2ba841f77ee3ccb.tar.xz
plus-3eeae12c498d1a4dbe969462d2ba841f77ee3ccb.zip
Initial commit.
This code based on mana client http://www.gitorious.org/mana/mana and my private repository.
Diffstat (limited to 'po/CMakeLists.txt')
-rw-r--r--po/CMakeLists.txt42
1 files changed, 42 insertions, 0 deletions
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
new file mode 100644
index 000000000..de35788eb
--- /dev/null
+++ b/po/CMakeLists.txt
@@ -0,0 +1,42 @@
+FIND_PACKAGE(Gettext REQUIRED)
+
+# based on the CMake 2.6.3 GETTEXT_CREATE_TRANSLATIONS
+# we need our own version because the upstream one contains
+# a call to msgmerge (updating po files) which can't be
+# disabled
+MACRO(MANAPLUS_GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg)
+ # make it a real variable, so we can modify it here
+ SET(_firstPoFile "${_firstPoFileArg}")
+
+ SET(_gmoFiles)
+ GET_FILENAME_COMPONENT(_potBasename ${_potFile} NAME_WE)
+ GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE)
+
+ SET(_addToAll)
+ IF(${_firstPoFile} STREQUAL "ALL")
+ SET(_addToAll "ALL")
+ SET(_firstPoFile)
+ ENDIF(${_firstPoFile} STREQUAL "ALL")
+
+ FOREACH (_currentPoFile ${_firstPoFile} ${ARGN})
+ GET_FILENAME_COMPONENT(_absFile ${_currentPoFile} ABSOLUTE)
+ GET_FILENAME_COMPONENT(_abs_PATH ${_absFile} PATH)
+ GET_FILENAME_COMPONENT(_lang ${_absFile} NAME_WE)
+ SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
+
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${_gmoFile}
+ COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile}
+ DEPENDS ${_absPotFile} ${_absFile}
+ )
+
+ INSTALL(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
+ SET(_gmoFiles ${_gmoFiles} ${_gmoFile})
+
+ ENDFOREACH (_currentPoFile )
+
+ ADD_CUSTOM_TARGET(translations ${_addToAll} DEPENDS ${_gmoFiles})
+ENDMACRO(MANAPLUS_GETTEXT_CREATE_TRANSLATIONS )
+
+FILE(GLOB POFILES *.po)
+MANAPLUS_GETTEXT_CREATE_TRANSLATIONS(manaplus.pot ALL ${POFILES})