2018-03-29 09:59:04 +03:00
|
|
|
#
|
|
|
|
# Generate the translation resource file
|
|
|
|
#
|
|
|
|
|
2018-05-13 22:09:26 +03:00
|
|
|
file(GLOB LANG_TS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/resources/langs/*.ts")
|
2018-03-29 09:59:04 +03:00
|
|
|
|
|
|
|
qt5_add_translation(QM_SRC ${LANG_TS_SRC})
|
2018-05-13 22:09:26 +03:00
|
|
|
qt5_create_translation(${QM_SRC})
|
2018-03-29 09:59:04 +03:00
|
|
|
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})
|
2018-05-13 22:09:26 +03:00
|
|
|
file(WRITE ${_qrc} "<RCC>\n <qresource prefix=\"/translations\">\n")
|
|
|
|
foreach(_lang ${QM_SRC})
|
|
|
|
get_filename_component(_filename ${_lang} NAME)
|
|
|
|
file(APPEND ${_qrc} " <file>${_filename}</file>\n")
|
|
|
|
endforeach(_lang)
|
|
|
|
file(APPEND ${_qrc} " </qresource>\n</RCC>\n")
|
2018-03-29 09:59:04 +03:00
|
|
|
endif()
|
|
|
|
|
|
|
|
qt5_add_resources(LANG_QRC ${_qrc})
|
2020-06-27 04:06:16 +03:00
|
|
|
if(Qt5QuickCompiler_FOUND AND COMPILE_QML)
|
2019-10-28 00:01:40 +03:00
|
|
|
qtquick_compiler_add_resources(QRC resources/res.qrc)
|
|
|
|
else()
|
|
|
|
qt5_add_resources(QRC resources/res.qrc)
|
|
|
|
endif()
|