diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2021-07-15 14:22:24 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-07-16 09:11:20 +0000 |
commit | 0975e6d437d105a2b5a3969fd84a7829b08e3dae (patch) | |
tree | 117f7503bfdac80554da7ee4623353ce09d82c37 /tests | |
parent | d7d7505f65c4f0f02185c0239f4f4e6e5a6cbad9 (diff) | |
download | qttools-0975e6d437d105a2b5a3969fd84a7829b08e3dae.tar.gz |
qt6_add_translations: Add OUTPUT_TARGETS argument
Consider a static library that a user wants to ship.
And consider embedding .qm files into a resource within this static
library.
Then the user must ship the object libraries that belong to the resource
too. In order to do that, users can specify a variable name in
OUTPUT_TARGETS that is filled with the OUTPUT_TARGETS of the inner
qt6_add_resource call.
Specifying OUTPUT_TARGETS for a target that is not a static library is a
no-op.
Task-number: QTBUG-95180
Change-Id: I3984ca0082c118fa7516dde252330028f85bf1f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit c7e7b67382146dd91727c773db4e745d1b57e580)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/cmake/test_translation_api/CMakeLists.txt | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/cmake/test_translation_api/CMakeLists.txt b/tests/auto/cmake/test_translation_api/CMakeLists.txt index 09887264f..81321a067 100644 --- a/tests/auto/cmake/test_translation_api/CMakeLists.txt +++ b/tests/auto/cmake/test_translation_api/CMakeLists.txt @@ -103,6 +103,21 @@ qt6_add_translations(app5 TS_FILES myobject_ru.ts RESOURCE_PREFIX "/tränslehschns") +# qt_add_translations on a static lib with a generated resource and the default resource prefix. +# Extract the created resource targets. +add_library(staticlib1 STATIC + myi18nobject.cpp) +target_include_directories(staticlib1 + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/some_dir) +target_link_libraries(staticlib1 PRIVATE Qt6::Core) +set(staticlib1_resource_targets "") +qt6_add_translations(staticlib1 + TS_FILES myobject_da.ts + OUTPUT_TARGETS staticlib1_resource_targets) +if("${staticlib1_resource_targets}" STREQUAL "") + message(FATAL_ERROR "staticlib1_resource_targets is empty.") +endif() + # Build the update_translations target add_custom_target(my_all_target ALL |