|
|
@ -60,6 +60,8 @@ qt5_add_translation(translations_FILES |
|
|
|
zh_TW.ts |
|
|
|
zh_TW.ts |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Generate a resource file which contains all translation files |
|
|
|
|
|
|
|
function(generate_translation_resource) |
|
|
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/translations.qrc.in" |
|
|
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/translations.qrc.in" |
|
|
|
"<!DOCTYPE RCC> |
|
|
|
"<!DOCTYPE RCC> |
|
|
|
<RCC version=\"1.0\"> |
|
|
|
<RCC version=\"1.0\"> |
|
|
@ -74,9 +76,12 @@ file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/translations.qrc.in" |
|
|
|
" </qresource> |
|
|
|
" </qresource> |
|
|
|
</RCC> |
|
|
|
</RCC> |
|
|
|
") |
|
|
|
") |
|
|
|
|
|
|
|
endfunction() |
|
|
|
|
|
|
|
|
|
|
|
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different |
|
|
|
generate_translation_resource() |
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/translations.qrc.in |
|
|
|
configure_file(${CMAKE_CURRENT_BINARY_DIR}/translations.qrc.in ./translations.qrc COPYONLY) |
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/translations.qrc) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
add_library(translations_library ${translations_FILES} ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc) |
|
|
|
add_library(translations_library ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# An explicit dependency is needed or AUTORCC will run before the translation files are created |
|
|
|
|
|
|
|
set_target_properties(translations_library PROPERTIES AUTOGEN_TARGET_DEPENDS "${translations_FILES}") |
|
|
|