Commit 433cd2dd authored by AlmAck's avatar AlmAck
Browse files

new translations cmake generation

parent 07c49ef7
FILE(GLOB_RECURSE PO_FILES *.po)
FIND_PROGRAM(PO2TS_EXECUTABLE
NAMES po2ts
)
IF(NOT PO2TS_EXECUTABLE)
MESSAGE(FATAL_ERROR "Unable to find the ‘po2ts’ executable, from the Translation Toolkit project.")
ENDIF(NOT PO2TS_EXECUTABLE)
add_translations(akabei ${PO_FILES})
FIND_PROGRAM(QT_LRELEASE_EXECUTABLE
NAMES lrelease
PATHS ${QT_BINARY_DIR}
NO_DEFAULT_PATH
)
IF(NOT QT_LRELEASE_EXECUTABLE)
MESSAGE(FATAL_ERROR "Qt4 lrelease not found. Make sure that it has been built and installed by the Qt4 package.")
ENDIF(NOT QT_LRELEASE_EXECUTABLE)
MACRO(GENERATE_TS_FILES_FROM_PO_FILES TS_FILES)
FOREACH(CURRENT_FILE ${ARGN})
GET_FILENAME_COMPONENT(PO_FILE ${CURRENT_FILE} ABSOLUTE)
GET_FILENAME_COMPONENT(PO_FILE_NAME ${CURRENT_FILE} NAME_WE)
SET(TS_FILE ${CMAKE_CURRENT_BINARY_DIR}/akabei_${PO_FILE_NAME}.ts)
ADD_CUSTOM_COMMAND(
OUTPUT ${TS_FILE}
COMMAND ${PO2TS_EXECUTABLE}
ARGS ${PO_FILE} ${TS_FILE}
DEPENDS ${PO_FILE}
)
SET(${TS_FILES} ${${TS_FILES}} ${TS_FILE})
ENDFOREACH(CURRENT_FILE)
ENDMACRO(GENERATE_TS_FILES_FROM_PO_FILES)
MACRO(GENERATE_QM_FILES_FROM_TS_FILES _sources)
FOREACH(_current_FILE ${ARGN})
GET_FILENAME_COMPONENT(_in ${_current_FILE} ABSOLUTE)
GET_FILENAME_COMPONENT(_basename ${_current_FILE} NAME_WE)
SET(_out ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.qm)
ADD_CUSTOM_COMMAND(
OUTPUT ${_out}
COMMAND ${QT_LRELEASE_EXECUTABLE}
ARGS -verbose ${_in} -qm ${_out}
DEPENDS ${_in}
)
SET(${_sources} ${${_sources}} ${_out})
ENDFOREACH(_current_FILE)
ENDMACRO(GENERATE_QM_FILES_FROM_TS_FILES)
FILE(GLOB PO_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.po)
GENERATE_TS_FILES_FROM_PO_FILES(TS_FILES ${PO_FILES})
GENERATE_QM_FILES_FROM_TS_FILES(QM_FILES ${TS_FILES})
ADD_CUSTOM_TARGET(translations ALL DEPENDS ${QM_FILES})
INSTALL(CODE "MESSAGE(\"Installing Akabei i18n files...\")")
INSTALL(FILES ${QM_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/akabe/translations)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment