Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
CMake
CMake
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,298
    • Issues 3,298
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 9
    • Merge Requests 9
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • External Wiki
    • External Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMake
  • CMakeCMake
  • Issues
  • #21549

Closed
Open
Created Dec 03, 2020 by Macintron@Macintron

CMake 3.17+ deletes Qt translations when updating the TS files

With CMake 3.16.8 or less, the following workflow was working, but 3.17+ deletes the Qt's TS files. The idea is taken from Professional CMake, 7th Edition, 31.4 Translations, by Craig Scott

Requirements

cmake 3.17+, Qt 5.9+, ninja

Concept

To update the translation files for Qt, UPDATE_TRANSLATIONS can be enabled. When finished, disable it. CMake 3.17+ deletes the updated TS files.

Adjust pathes in the script update_translation.sh to automate the workflow.

Steps to reproduce

copy attachted files to QtTranslationDemo.

mkdir build  # NOT in QtTranslationDemo
cd build
cmake -G Ninja -DCMAKE_PREFIX_PATH=[pathToQtDir/5.15.2/clang_64] ../QtTranslationDemo
ninja
./demo

Output should be:

Demo
de.qm: 85 bytes
  Language: 'Deutsch'
  greeting: ''
en.qm: 85 bytes
  Language: 'English'
  greeting: ''

now the problem starts:

cmake -DUPDATE_TRANSLATIONS=ON ../QtTranslationDemo
ninja demoTranslations
cmake -DUPDATE_TRANSLATIONS=OFF ../QtTranslationDemo
# new strings ("greeting") should haven been added to the ts files, but TS files are deleted instead!

Why are the TS files get deleted? Is this a bug in CMake 3.17+ or a bug in my workflow?

build info

The build directory must NOT be inside the sources.

source files

CMakeLists.txt

de.ts

en.ts

main.cpp

update_translation.sh

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
3.18.6
Milestone
3.18.6 (Past due)
Assign milestone
Time tracking
None
Due date
None