How to update * .ts files (for Qt Linguist) in a CMake Qt project?

I found how to use .ts files in CMake:

SET(TRANS localization/en_en.ts)
QT5_ADD_TRANSLATION(QM ${TRANS})

(and added to executable files).

And when I run lupdate from the Qt menu, I have the following: lupdate warning: no TS files specified. Only diagnostics will be produced.

So how can I update * .ts for a simple CMake project?

+4
source share
1 answer

Try using the following:

file(GLOB TS_FILES "${PROJECT_SOURCE_DIR}/*.ts")

qt5_create_translation(QM_FILES
    ${PROJECT_SOURCE_DIR}
    ${TS_FILES}
    OPTIONS -source-language en_US -no-obsolete)

add_executable(${PROJECT_NAME} ${OS_BUNDLE} ${SOURCES} ${RESOURCES} ${QM_FILES})

Please note that QM_FILESmust be in the list of sources for the target ( ${PROJECT_NAME}here).

0
source

Source: https://habr.com/ru/post/1615369/


All Articles