summary refs log tree commit diff
path: root/cmake/Translations.cmake
blob: 16ca72edb87084a2371a278fdf6a0f0c0f9b1f0e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
# Generate the translation resource file
#

FILE(GLOB LANG_TS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/resources/langs/*.ts")

qt5_add_translation(QM_SRC ${LANG_TS_SRC})
add_custom_target(LANG_QRC ALL DEPENDS ${QM_SRC})

# Generate a qrc file for the translations
set(_qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc)

if(NOT EXISTS ${_qrc})
    file(WRITE ${_qrc} "<RCC> <qresource prefix=\"/translations\">")
    foreach(_lang ${QM_SRC})
        get_filename_component(_filename ${_lang} NAME)
        file(APPEND ${_qrc} "<file>${_filename}</file>")
    endforeach(_lang)
    file(APPEND ${_qrc} "</qresource> </RCC>")
endif()

qt5_add_resources(LANG_QRC ${_qrc})
qt5_add_resources(QRC resources/res.qrc)