Hi,

Project developers that use CMake and a static Qt 5 build probably know that 
the developer experience(DX) wasn't the best (depending on which Qt modules or 
plugins the project uses).

When we switched building Qt 6 to CMake, we hoped we could provide a nicer 
CMake project DX which involves static Qt builds. Everything just works™.

Unfortunately along the way we've been hitting limitations in CMake, which 
stopped us from providing the DX we want to offer.

If you search the bug tracker, you can see we've had a constant stream of 
issues: incorrect link line order causing failed linkage, missing plugins, 
discarded symbols from resource objects files, etc

We've been trying various workarounds to address these issues, but they either 
ended up being unreliable or just not fixing them.


We have an idea on how to address the issues properly, but we'd have to enforce 
user projects to call a qt provided function for each executable or library 
that uses a static Qt library.

The project would have to do

    add_library / add_executable(A)
    # .....
    # at the end of the project
    qt_finalize_target(A)


Or if the project uses our qt provided wrappers for libraries and executables 
and a CMake version >= 3.19, it can just do


    qt_add_library(A) / qt_add_executable(A)


The project can use the wrappers with a lower CMake version as well, but it'd 
still have to call qt_finalize_target() at the end of the project then


    qt_add_library(A) / qt_add_executable(A)
    # ...
    # at the end of the project
    qt_finalize_target(A)


This of course requires developers to adapt their projects (adding the 
qt_finalize_target calls, or switching to a new CMake version and use the Qt 
wrappers).

I think providing a DX where the developer doesn't have to worry about static 
library dependencies is worth the trade-off of having to adapt the not so many 
Qt 6 projects in the wild.

To reiterate, this requirement would only be for projects that use a static Qt. 
Projects that use a shared Qt build don't require the new functions.

I'd like to hear your thoughts on this.
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to