lupdate error: Passing a CMakeLists.txt as project file is not supported
We are using QT 6.7.2 and started a simple application with one label.
Also have tree translation files.
We added a label to the UI with a text tr("Welcome).
Now we try to use the buildin tool Linguist and update translations
The following issues where found:
Quote:
Starting external tool "C:\Qt\6.7.2\mingw_64\bin\lupdate.exe D:/QTProjects/Test/Translation1/CMakeLists.txt"
lupdate error: Passing a CMakeLists.txt as project file is not supported.
Please use the 'qt_add_lupdate' CMake command and build the 'update_translations' target.
"C:\Qt\6.7.2\mingw_64\bin\lupdate.exe" finished with error
What are we doing wrong?
Have we forgot something?
Please advise
Re: lupdate error: Passing a CMakeLists.txt as project file is not supported
Have you read the documentation on using Linguist in a cmake build?
You need to add two commands to your CMakelists.txt file:
One to add the CMake components needed to invoke Linquist during build time:
Code:
find_package(Qt6 REQUIRED COMPONENTS LinguistTools)
And another to actually invoke Linguist to create .ts files for your sources:
Code:
qt_add_lupdate(target TS_FILES file1.ts [file2.ts ...]
[SOURCES source1.cpp [sources2.cpp ...]]
[INCLUDE_DIRECTORIES directory1 [directory2 ...]]
[NO_GLOBAL_TARGET]
[OPTIONS ...])
The documentation explains what these commands and their parameters mean.