I have this CMakeLists.txt in the directory with the translation files ( *.ts ):
SET(TRANSLATIONS lang_de.ts lang_en.ts ) FIND_PACKAGE(Qt5LinguistTools) QT5_ADD_TRANSLATION(QM_FILES ${TRANSLATIONS}) SET(QM_FILES ${QM_FILES} PARENT_SCOPE) ADD_CUSTOM_TARGET (translations ALL DEPENDS ${QM_FILES})
It builds *.qm files from the specified *.ts .
But I want to improve this and get two custom goals that won't be built automatically. One for adding new lines from sources to ts files and one for updating ts . The latter would ts from sources and remove obsolete lines from ts .
I tried adding this after the lines above:
ADD_CUSTOM_TARGET ( ts_append COMMAND QT5_CREATE_TRANSLATION(QM_FILES ${CMAKE_SOURCE_DIR}/src/app ${TRANSLATIONS} OPTIONS -I ${CMAKE_SOURCE_DIR}/src) ) ADD_CUSTOM_TARGET ( ts_refresh COMMAND QT5_CREATE_TRANSLATION(QM_FILES ${CMAKE_SOURCE_DIR}/src/app ${TRANSLATIONS} OPTIONS -no-obsolete -I ${CMAKE_SOURCE_DIR}/src) )
but it seems like I can't use the QT5_CREATE_TRANSLATION macro inside a custom target, right?
Perhaps I'm wrong, how would you solve this problem: is it easy to update ts and not lose them after make clean ?
source share