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
commit6a56aad6d424a19569b1628ca1a186e34c0c39ba (patch)
tree2490abb36785ca41b718da2ebcc646ac0f314fd5
parentb9ba498a1be42458616ed01f9b56aee5692a1d72 (diff)
downloadqttools-6a56aad6d424a19569b1628ca1a186e34c0c39ba.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 bcca1789c..637202267 100644
--- a/src/linguist/Qt6LinguistToolsMacros.cmake
+++ b/src/linguist/Qt6LinguistToolsMacros.cmake
@@ -147,7 +147,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}")