summaryrefslogtreecommitdiff
path: root/src/linguist
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2022-10-18 09:49:25 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2022-10-18 11:21:35 +0200
commitef676896edb9750353e012fc28cbed22f51167c1 (patch)
treef50cace710a021e741fea459160d028f904e5d2d /src/linguist
parent54f97c0aafebe0c041dc6e1501d6f33613931a87 (diff)
downloadqttools-ef676896edb9750353e012fc28cbed22f51167c1.tar.gz
lupdate: Print error on attempt to run lupdate on a CMakeLists.txt
Task-number: QTBUG-107681 Change-Id: I46cc9464db450b94bbd975076c3f3aaf411a747c Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Diffstat (limited to 'src/linguist')
-rw-r--r--src/linguist/lupdate/main.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/linguist/lupdate/main.cpp b/src/linguist/lupdate/main.cpp
index 740d5f406..126318e94 100644
--- a/src/linguist/lupdate/main.cpp
+++ b/src/linguist/lupdate/main.cpp
@@ -1042,6 +1042,14 @@ int main(int argc, char **argv)
printErr(u"lupdate warning: -target-language usually only"
" makes sense with exactly one TS file.\n"_s);
+ if (proFiles.isEmpty() && resourceFiles.isEmpty() && sourceFiles.length() == 1
+ && QFileInfo(sourceFiles.first()).fileName() == u"CMakeLists.txt"_s) {
+ printErr(u"lupdate error: Passing a CMakeLists.txt as project file is not supported.\n"_s
+ u"Please use the 'qt_add_lupdate' CMake command and build the "_s
+ u"'update_translations' target.\n"_s);
+ return 1;
+ }
+
QString errorString;
if (!proFiles.isEmpty()) {
runInternalQtTool(u"lupdate-pro"_s, app.arguments().mid(1));