1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

launcher & editor: use qt_add_translations for Qt6

This will make possible to run update_translations target on
Qt6 build of VCMI
This commit is contained in:
Konstantin 2023-01-29 20:41:55 +03:00
parent 848e858312
commit f577b7240b
2 changed files with 22 additions and 10 deletions

View File

@ -90,11 +90,6 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
if(TARGET Qt6::Core)
qt_wrap_ui(launcher_UI_HEADERS ${launcher_FORMS})
if(ENABLE_TRANSLATIONS)
set_source_files_properties(${launcher_TS} PROPERTIES OUTPUT_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/translation)
# TODO: consider using qt_add_translations: https://doc.qt.io/qt-6/qtlinguist-cmake-qt-add-translations.html
qt_add_translation( launcher_QM ${launcher_TS} )
endif()
else()
qt5_wrap_ui(launcher_UI_HEADERS ${launcher_FORMS})
if(ENABLE_TRANSLATIONS)
@ -114,6 +109,17 @@ else()
add_executable(vcmilauncher WIN32 ${launcher_QM} ${launcher_SRCS} ${launcher_HEADERS} ${launcher_UI_HEADERS} ${launcher_ICON})
endif()
if(TARGET Qt6::Core)
if(ENABLE_TRANSLATIONS)
set_source_files_properties(${launcher_TS} PROPERTIES OUTPUT_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/translation)
qt_add_translations(vcmilauncher
TS_FILES ${launcher_TS}
QM_FILES_OUTPUT_VARIABLE launcher_QM
INCLUDE_DIRECTORIES
${CMAKE_CURRENT_BINARY_DIR})
endif()
endif()
if(WIN32)
set_target_properties(vcmilauncher
PROPERTIES

View File

@ -92,11 +92,6 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
if(TARGET Qt6::Core)
qt_wrap_ui(editor_UI_HEADERS ${editor_FORMS})
if(ENABLE_TRANSLATIONS)
set_source_files_properties(${editor_TS} PROPERTIES OUTPUT_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/translation)
# TODO: consider using qt_add_translations: https://doc.qt.io/qt-6/qtlinguist-cmake-qt-add-translations.html
qt_add_translation( editor_QM ${editor_TS} )
endif()
else()
qt5_wrap_ui(editor_UI_HEADERS ${editor_FORMS})
if(ENABLE_TRANSLATIONS)
@ -111,6 +106,17 @@ endif()
add_executable(vcmieditor WIN32 ${editor_QM} ${editor_SRCS} ${editor_HEADERS} ${editor_UI_HEADERS} ${editor_ICON})
if(TARGET Qt6::Core)
if(ENABLE_TRANSLATIONS)
set_source_files_properties(${editor_TS} PROPERTIES OUTPUT_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/translation)
qt_add_translations(vcmieditor
TS_FILES ${editor_TS}
QM_FILES_OUTPUT_VARIABLE editor_QM
INCLUDE_DIRECTORIES
${CMAKE_CURRENT_BINARY_DIR})
endif()
endif()
if(WIN32)
set_target_properties(vcmieditor
PROPERTIES