@Sauntor said in How to make a library with the installed layout looks like Qt's internal modules (a.k. QtCore, QtQml, ect.)?:
All in a word, how to make the library users use Demo like the way they use QtCore, for example:
You cannot control how the users use the headers provided but you can give then the option of "clean" header names like <QWidget> the same way that Qt does it. The deployed headers files are:
- include
- QtWidgets (directory)
- QtWidgets (file)
- QWidget (file)
- qwidget.h (file)
The file "QWidget" simply contains:
#include "qwidget.h"
The file QtWidgets similarly includes all the headers for the entire module.
The qmake or cmake setup ensures that the include/QtWidget folder is added to the include path when the widget module is invoked (e.g. QT += widgets). The include folder is also present. So, the user can specify:
// found via the top level include path
#include <QtWidgets/QWidget>
#include <QtWidgets/qwidget.h>
// found via the QtWidgets include path
#include <QtWidgets>
#include <QWidget>
#include <qwidget.h>
To do this for your library you need to deploy at least the "clean" files.
I do not want to write any camel cased header wrappers manually, it should be auto generated, and how?
You only need to do this once and check it in to your source control. It's probably faster than trying to automate. As for how you could automate this; there's no magic bullet here.