summaryrefslogtreecommitdiff
path: root/translations
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2021-08-26 18:00:04 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2021-08-27 09:01:36 +0200
commitc17fc36d54b247e5aee9e609ac91687a9548c257 (patch)
tree1095af0a55b0f0194eb0ee6b70715bf0d610c35f /translations
parentdbcf76dc2f7173906eee6c6f83630a90ab80b4a4 (diff)
downloadqttranslations-c17fc36d54b247e5aee9e609ac91687a9548c257.tar.gz
Fix permanently out-of-date .qm files
An incremental build without changed .ts files must be a null build. However, the .qm files were always re-generated. That was, because add_custom_target was used to run lrelease, and such targets are always out of date. Use the new target-based translation API that uses add_custom_command under the hood. This fixes the described issue and simplifies the project file a lot. For the target that runs lupdate: the .ts file must not be a by-product of the custom target. Otherwise, the updateqm target would trigger the ts-${catalog}-${lang} targets. There should be no connection between the lrelease and lupdate targets. Pick-to: 6.2 Fixes: QTBUG-96038 Change-Id: I1faf35f1eab154be3a12dfaed93d64799dbb6ff1 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'translations')
-rw-r--r--translations/CMakeLists.txt33
1 files changed, 8 insertions, 25 deletions
diff --git a/translations/CMakeLists.txt b/translations/CMakeLists.txt
index 6b68afe..cc5679e 100644
--- a/translations/CMakeLists.txt
+++ b/translations/CMakeLists.txt
@@ -14,7 +14,6 @@ endfunction()
function(add_ts_target target input_file output_file)
add_custom_target(${target}
- BYPRODUCTS ${output_file}
COMMAND ${QT_CMAKE_EXPORT_NAMESPACE}::lupdate -locations relative -no-ui-lines -no-sort "@${input_file}" -ts ${output_file}
)
endfunction()
@@ -131,6 +130,8 @@ add_dependencies(check-ts ts-all)
add_custom_target(updateqm ALL)
file(GLOB ts_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.ts")
+file(GLOB en_ts_files "${en_ts_file_dir}/*.ts")
+list(APPEND ts_files ${en_ts_files})
if(QT_WILL_INSTALL)
set(qm_output_dir "${QT_BUILD_DIR}/${INSTALL_TRANSLATIONSDIR}")
@@ -138,30 +139,12 @@ else()
set(qm_output_dir "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_TRANSLATIONSDIR}")
endif()
-foreach(file IN LISTS ts_files)
- string(REGEX REPLACE "\\.ts$" ".qm" qm_file ${file})
- set(output_file "${qm_output_dir}/${qm_file}")
- add_custom_target(updateqm-${file}
- BYPRODUCTS ${output_file}
- COMMAND "${CMAKE_COMMAND}" -E make_directory "${qm_output_dir}"
- COMMAND ${QT_CMAKE_EXPORT_NAMESPACE}::lrelease "${CMAKE_CURRENT_SOURCE_DIR}/${file}" -qm "${output_file}"
- )
- qt_install(FILES ${output_file} DESTINATION "${INSTALL_TRANSLATIONSDIR}")
- add_dependencies(updateqm updateqm-${file})
-endforeach()
-
-file(GLOB ts_files RELATIVE ${en_ts_file_dir} "${en_ts_file_dir}/*.ts")
-foreach(file IN LISTS ts_files)
- string(REGEX REPLACE "\\.ts$" ".qm" qm_file ${file})
- set(output_file "${qm_output_dir}/${qm_file}")
- add_custom_target(updateqm-${file}
- BYPRODUCTS ${output_file}
- COMMAND ${QT_CMAKE_EXPORT_NAMESPACE}::lrelease "${en_ts_file_dir}/${file}" -qm "${output_file}"
- )
- qt_install(FILES ${output_file} DESTINATION "${INSTALL_TRANSLATIONSDIR}")
- add_dependencies(updateqm updateqm-${file})
-endforeach()
-
+set_source_files_properties(${ts_files} PROPERTIES OUTPUT_LOCATION "${qm_output_dir}")
+qt_add_lrelease(updateqm
+ TS_FILES ${ts_files}
+ NO_GLOBAL_TARGET
+ QM_FILES_OUTPUT_VARIABLE qm_files)
+qt_install(FILES ${qm_files} DESTINATION "${INSTALL_TRANSLATIONSDIR}")
# Custom target to add modified ts files to git
add_custom_target(stage-ts