Skip to content

Commit da4d516

Browse files
committed
[cmake] Replace deprecated QT_CREATE_TRANSLATION
Use modern qt_add_translations instead.
1 parent 8df3087 commit da4d516

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

‎gui/CMakeLists.txt‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ CheckOptions:
1515
file(GLOB tss "*.ts")
1616
QT_WRAP_UI(uis_hdrs ${uis})
1717
QT_ADD_RESOURCES(resources "gui.qrc")
18-
# TODO: passing "-no-obsolete" here breaks the translations
19-
QT_CREATE_TRANSLATION(qms ${CMAKE_CURRENT_SOURCE_DIR} ${tss})
20-
list(APPEND cppcheck-gui-deps ${hdrs} ${uis_hdrs} ${resources} ${qms})
18+
list(APPEND cppcheck-gui-deps ${hdrs} ${uis_hdrs} ${resources})
2119
add_custom_target(gui-build-deps SOURCES ${cppcheck-gui-deps})
2220

2321
list(APPEND cppcheck-gui_SOURCES ${srcs})
@@ -27,6 +25,10 @@ CheckOptions:
2725

2826
add_executable(cppcheck-gui ${cppcheck-gui-deps} ${cppcheck-gui_SOURCES})
2927
target_link_libraries(cppcheck-gui cppcheck-core simplecpp tinyxml2 picojson frontend)
28+
qt_add_translations(cppcheck-gui
29+
TS_FILES ${tss}
30+
QM_FILES_OUTPUT_VARIABLE qms)
31+
add_dependencies(cppcheck-gui release_translations)
3032

3133
set_target_properties(cppcheck-gui PROPERTIES AUTOMOC ON)
3234
set_target_properties(cppcheck-gui PROPERTIES WIN32_EXECUTABLE ON)

‎gui/readme.txt‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ has several options to select tests etc. You can get the help by running
4545
Translations
4646
------------
4747
The GUI is translated to several languages. Qt comes with two tools to update
48-
and compile the translations. lupdate updates translations files from the code
49-
and lrelease compiles translation files use with the executable.
50-
51-
The translations are automatically updated and compiled within CMake.
48+
and compile the translations.
49+
50+
1. lupdate updates translations files from the code.
51+
Updating the translation files from the code is a separate step: run
52+
"lupdate gui.pro"
53+
in the gui directory.
54+
2. lrelease compiles translation files use with the executable.
55+
The translations are automatically compiled within CMake.

0 commit comments

Comments
 (0)