5

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?

tomvodi
  • 5,577
  • 2
  • 27
  • 38
user453575457
  • 464
  • 6
  • 21

1 Answers1

0

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).

Tomilov Anatoliy
  • 15,657
  • 10
  • 64
  • 169