[Development] Possible breaking change in Qt 6.9.0 beta 3 CMake macros?
Paul Colby
qt at colby.id.au
Sat Mar 8 23:46:04 CET 2025
Hi Qt devs,
I kind of just want a quick sanity check here for: am I doing
something wrong, or does Qt 6.9.0 beta 3 break the default location of
generated *.qm files?
I'm pretty sure this was fine in 6.9 beta 1 (and is fine for Qt's 6.2
through 6.8). I'm not sure re beta 2, but the Qt commit history suggests
that one was ok.
Basically, as I understand it:
1. Qt 6.9 beta 3 adds a QM_OUTPUT_DIRECTORY option to
the qt_add_translations CMake macro.
2. the docs claim that QM_OUTPUT_DIRECTORY defaults
to CMAKE_CURRENT_BINARY_DIR, which would be consistent with the previous
behaviour.
3. the behaviour I'm seeing now (with Qt 6.9.0 beta 3 only) is that qm
files are being placed, by default, in the top-level PROJECT_BINARY_DIR,
not CMAKE_CURRENT_BINARY_DIR as claimed by the new docs.
4. this means that projects with multiple sub-directories, with their own
qt_add_translations calls, are now clashing resulting in errors like:
CMake Error at
/home/paul/opt/qt/6.9.0/gcc_64/lib/cmake/Qt6LinguistTools/Qt6LinguistToolsMacros.cmake:574
(add_custom_command):
Attempt to add a custom rule to output
/home/paul/tmp/build/dokit-gcc-6.9.0-debug/en_AU.qm.rule
which already has a custom rule.
Call Stack (most recent call first):
/home/paul/opt/qt/6.9.0/gcc_64/lib/cmake/Qt6LinguistTools/Qt6LinguistToolsMacros.cmake:846
(qt6_add_lrelease)
/home/paul/opt/qt/6.9.0/gcc_64/lib/cmake/Qt6LinguistTools/Qt6LinguistToolsMacros.cmake:815:EVAL:1
(qt6_add_translations)
CMakeLists.txt:DEFERRED
This appears to be because, where previously the target qm files were being
built in sub-directories, they are now all being built in the top-level
build directory, resulting in multiple rules targeting the same destination
(with different sources).
If this is in expected break, then I'm more than happy to fix it by simply
setting QM_OUTPUT_DIRECTORY to CMAKE_CURRENT_BINARY_DIR (though the Qt 6.9
docs, as I read them, suggest that should already be the default).
Alternatively, if this is indeed a bug, I'm more than happy to provide more
info here, or report it at bugreports.qt.io. Just let me know which is
preferred.
Thanks!
Paul C.
----
http://colby.id.au
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20250309/70655820/attachment.htm>
More information about the Development
mailing list