1
I’m trying to separate my application from a small open lib I created, so I put the files on .pri
and includes in the .pro
, the structure of the folder was like this:
c:/projetos/
├── minhalib
│ ├── minhalib.pri
│ ├── foo
│ | ├── foo.cpp
│ | └── foo.h
│ └── bar
│ ├── bar.cpp
│ └── bar.h
|
└── aplicativo
├── aplicativo.pro
├── main.cpp
├── mainwindow.cpp
└── mainwindow.h
In the app . pro I have this:
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = aplicacao
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
include($PWD/../../minhalib/minhalib.pri)
And in the minhalib/foo.pri
I have this:
SOURCES += $$PWD/foo/foo.cpp \
$$PWD/bar/bar.cpp
HEADERS += $$PWD/foo/foo.h \
$$PWD/bar/bar.h
In the main.cpp
I called it so:
#include "mainwindow.h"
#include "../minhalib/bar/bar.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Bar bar;
bar.test();
MainWindow w;
w.show();
return a.exec();
}
Note that I include so #include "../minhalib/bar/bar.h"
, but I would like to include in a simpler way, something like:
#include <bar/bar>
#include <foo/foo>
Or:
#include "bar/bar.h"
#include "foo/foo.h"
How can I do this by setting up .pri