mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor(cmake): fix missing dependency
This commit is contained in:
parent
f37813ff88
commit
34c1a1e96b
41
translations/CMakeLists.txt
vendored
41
translations/CMakeLists.txt
vendored
|
@ -60,23 +60,28 @@ qt5_add_translation(translations_FILES
|
||||||
zh_TW.ts
|
zh_TW.ts
|
||||||
)
|
)
|
||||||
|
|
||||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/translations.qrc.in"
|
# Generate a resource file which contains all translation files
|
||||||
"<!DOCTYPE RCC>
|
function(generate_translation_resource)
|
||||||
<RCC version=\"1.0\">
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/translations.qrc.in"
|
||||||
<qresource prefix=\"/translations\">
|
"<!DOCTYPE RCC>
|
||||||
")
|
<RCC version=\"1.0\">
|
||||||
foreach(qm ${translations_FILES})
|
<qresource prefix=\"/translations\">
|
||||||
get_filename_component(qm_name ${qm} NAME)
|
")
|
||||||
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/translations.qrc.in"
|
foreach(qm ${translations_FILES})
|
||||||
" <file alias=\"${qm_name}\">${qm}</file>\n")
|
get_filename_component(qm_name ${qm} NAME)
|
||||||
endforeach(qm)
|
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/translations.qrc.in"
|
||||||
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/translations.qrc.in"
|
" <file alias=\"${qm_name}\">${qm}</file>\n")
|
||||||
" </qresource>
|
endforeach(qm)
|
||||||
</RCC>
|
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/translations.qrc.in"
|
||||||
")
|
" </qresource>
|
||||||
|
</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}")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user