user453575457
user453575457

Reputation: 602

How to update *.ts (for Qt Linguist) files in 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 executables).

And when i run lupdate from the Qt menu I've got the following: lupdate warning: no TS files specified. Only diagnostics will be produced.

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

Upvotes: 6

Views: 4802

Answers (1)

Tomilov Anatoliy
Tomilov Anatoliy

Reputation: 16711

Try to use 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})

Note, that QM_FILES should be in the list of sources for the target (${PROJECT_NAME} here).

Upvotes: 0

Related Questions