Currently qtbase and qtdeclarative have some public CMake API marked as Technical Preview.
The important bits are the qt_add_plugin and qt6_add_qml_module ones.
They should be refactored / fixed, to ensure they work for public example projects (importantly as standalone projects).
This probably implies moving a big chunk of qt_internal_add_plugin implementation into the public qt_add_plugin counterpart.
The main idea behind the refactoring would be not to have duplicate target creation in the public and private counterparts.
So for qt_internal_add_plugin and qt6_add_plugin case, the add_library() calls should be removed from the internal function, and moved into the public one, as well as any additional logic that makes sense to move (like CLASS_NAME handling, plugin type handling, qml plugin handling, file name suffix handling, etc).
The OUTPUT_DIR and INSTALL_DIR logic should probably be kept in the internal variant.
The same should be done for qt_internal_add_qml_module and qt6_add_qml_module.