summaryrefslogtreecommitdiff
path: root/po/CMakeLists.txt
diff options
context:
space:
mode:
authorBernd Wachter <bwachter-tmw@lart.info>2009-04-08 10:48:34 +0200
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-04-08 10:57:13 +0200
commit098b9f71c878af8862e8ef80289e806c93464513 (patch)
tree77b5c9c36561856cf0a011db027965546d84a52e /po/CMakeLists.txt
parent767a8d93aec58805f3c087c3a1c301104f511acc (diff)
downloadmana-098b9f71c878af8862e8ef80289e806c93464513.tar.gz
mana-098b9f71c878af8862e8ef80289e806c93464513.tar.bz2
mana-098b9f71c878af8862e8ef80289e806c93464513.tar.xz
mana-098b9f71c878af8862e8ef80289e806c93464513.zip
Disable po-update for cmake; move buildflags to prevent overwriting
Diffstat (limited to 'po/CMakeLists.txt')
-rw-r--r--po/CMakeLists.txt49
1 files changed, 39 insertions, 10 deletions
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
index 93d94f3a..85cd439d 100644
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@ -1,13 +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(TMW_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(TMW_GETTEXT_CREATE_TRANSLATIONS )
+
FILE(GLOB POFILES *.po)
-GETTEXT_CREATE_TRANSLATIONS(tmw.pot ${POFILES})
-# This is an ugly hack to enable building of translations with
-# the default target due to a bug in GETTEXT_CREATE_TRANSLATIONS.
-# The bug has been fixed in recent CMake 2.6.3. Once 2.6.3 is widely
-# deployed the above line should be changed to:
-# GETTEXT_CREATE_TRANSLATIONS(tmw.pot ALL ${POFILES})
-# and the following two lines removed
-# 2009-04-08 Bernd Wachter <bwachter-tmw@lart.info>
-ADD_CUSTOM_TARGET(transfix ALL)
-ADD_DEPENDENCIES(transfix translations)
+TMW_GETTEXT_CREATE_TRANSLATIONS(tmw.pot ALL ${POFILES})