summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2023-01-27 11:28:23 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-01-27 11:20:22 +0000
commitfe97c27a4aa76dbc11d61c9a709cda53141f86a2 (patch)
treefb823463e13db8cff15c270a98814929eeae75ef
parente7208d6387c0f1f218d40d9c31a5eddf2cd6d038 (diff)
downloadqttools-fe97c27a4aa76dbc11d61c9a709cda53141f86a2.tar.gz
CMake: Don't pass .ts files as sources to lupdate
With the qt6_add_lupdate command, lupdate gets passed a list of sources of a target. This list might contain the .ts file. There's an undocumented feature of lupdate: it can take .ts files as additional sources for translation strings (see commit b3f6b61a584fbaf047cf617a4b9cf8d9e92d2882). Having the same .ts file as input and output for lupdate can result in accumulating duplicate translations. Filter the list of source files to exclude .ts files. Fixes: QTBUG-109316 Change-Id: Idea80e98655729167580b33bf7cb811653f407c7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 10488623eb0baf70e906875b30d9c4d9067ea9b1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/linguist/Qt6LinguistToolsMacros.cmake3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/linguist/Qt6LinguistToolsMacros.cmake b/src/linguist/Qt6LinguistToolsMacros.cmake
index 49ee01c07..8ed87d56e 100644
--- a/src/linguist/Qt6LinguistToolsMacros.cmake
+++ b/src/linguist/Qt6LinguistToolsMacros.cmake
@@ -176,7 +176,8 @@ function(qt6_add_lupdate target)
if(arg_SOURCES)
qt_internal_make_paths_absolute(sources "${arg_SOURCES}")
else()
- set(sources "$<TARGET_PROPERTY:${target},SOURCES>")
+ set(exclude_regex "\\.ts$")
+ set(sources "$<FILTER:$<TARGET_PROPERTY:${target},SOURCES>,EXCLUDE,${exclude_regex}>")
endif()
qt_internal_make_paths_absolute(ts_files "${arg_TS_FILES}")