Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.6.3
Description
CMake has properties with transitive collection features like INTERFACE_LINK_LIBRARIES, but it does not allow creating custom properties with a transitive behavior.
Having such a feature would help us in the following scenarios:
1) Propagate metatypes.json files without using the INTERFACE_SOURCES hack that pollutes final target SOURCES in IDEs.
It also doesn't quite work for targets that link PRIVATEly instead of PUBLICly.
We had to do multiple fixes to replicate metatypes json dependencies from qml plugins to qml backing libraries.
2) Tracking license requirements. We could tag each target with a list of licenses like MIT, GPL, and then generate a file at build time with full list of licences used.
3) It might help static plugin propagation when used in conjunction with INTERFACE_LINK_LIBRARIES_DIRECT feature, where we will track a list of modules that were merged into a final executable, to know which static plugins to link.
Currently we have both finalizer hacks and non-robust genex hacks for this.
4) Tracking dll / runtime / resource dependencies, as an additional info to know which libraries need to be deployed with an application. AFAIK this came up recently for (Linux?) deployment, it was related to WebEngine, and to know when to deploy additional resources like webengine dictionary files and icu data files.
5) We might be able to improve the QtEntryPoint module link handling, because we had some discussions about it with Tor Arne back in 2020, and we had to come up with some sub-optimal solution, but i don't remember the exact details.
6) Allow cleaner implementation of collecting dependencies for pkg config .pc file generation. Currently we rely on various genex parsing / removing hacks, as well as manual target traversal using __qt_internal_walk_libs which is not genex friendly.
One thing to note is that we will probably need to be able to control whether the new custom property pierces PRIVATE dependencies, and whether it pierces private STATIC library dependencies.
So if we set _interface_qt_module_license property of Core target to GPL, double_conversion to MIT, Core links PRIVATEly to double_conversion, and myapp links PRIVATEly to Core, then the $<TARGET_PROPERTY:myapp,_interface_qt_module_license> genex should contain both MIT and GPL.
Another thing of not is the custom properties should ideally support as many generator expressions as feasible. Genexes like $<BUILD_INTERFACE:> / $<INSTALL_INTERFACE:> will have to be handled somehow.
Ideally genexes like $<LINK_LANGUAGE:> should be handled as well, perhaps by allowing to strip the genex, but keeping its contents.
This would be helpful for .pc file generation when exporting the transitive compile options / link options.
Upstream issue: https://gitlab.kitware.com/cmake/cmake/-/issues/20416
Attachments
Gerrit Reviews
For Gerrit Dashboard: QTBUG-121194 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
561059,3 | CMake: Propagate metatypes json transitively when using CMake 3.30 | dev | qt/qtbase | Status: DEFERRED | 0 | 0 |
561060,2 | CMake: Consume transitive metatypes json files when using CMake 3.30 | dev | qt/qtdeclarative | Status: DEFERRED | 0 | 0 |
561141,1 | WIP: CMake: Propagate licenses via custom transitive properties | dev | qt/qtbase | Status: DEFERRED | -2 | 0 |