A QML-friendly library should come with metatype generation enabled by default, the include directories set up so that any type registrations can be compiled, an option to enable QML type registration, a nice way to add linked libraries, and possibly more. I currently have to do this (and I don't know if it actually works):
QML-friendly should be the default for any Qt-based library. So, it should be called something generic like "qt_add_library".
Furthermore, qt_add_qml_files should be able to attach QML files to any QML-friendly target. This is necessary for QML modules with QML files to have optional plugins: We need to compile the qmlcachegen-processed QML files into a library the plugin can link. The plugin should be an empty shell that only loads such a base library.
For example, the QtTest import has a few QML files. The fact that it's currently optional means the plugin might not be loaded at all. Therefore, the qmlcachegen-compiled variants of the QML files may not be available at run time. This is not great as they will then be re-compiled on each invocation of any application that uses them.
Instead, the QML files should be compiled into libQtQuickTest.so. If the user application links libQtQuickTest.so, the plugin won't be loaded. If the QML files are in libQtQuickTest.so, rather than in the plugin, they will still be available.