Reputation: 16359
I have a project which has lots of includepaths, source and header files. The project is run as a standalone application (it's not a library).
I would like to implement tests (Qt unit test framework) for new features for that application and for that, I require the includes, sources and header files of the (application) project to be available in the (testing) project.
I have tried putting the following in the testing project .pro file:
include(../application/app.pro) #app.pro is the application project
However first it complains about main.cpp
, and if I comment that out there is a parsing error. (commenting main.cpp is bad since I'm changing the main project just so that the testing will compile)
I can get the behavior I want by manually copying all the includepath's, source and header fields from the (application) project but am looking for a cleaner way.
What would be the optimal way to do this? Is it possible to painlessly include one .pro into another?
Upvotes: 0
Views: 1840
Reputation: 170
You should perform two modifications:
E.g., you will have build.pri:
# build.pri
TOPDIR = $$PWD
INCLUDEPATH += . \
$$TOPDIR/include
DEPENDPATH += $$TOPDIR
INCLUDEPATH += $$TOPDIR/additional/libararies
HEADERS += all.h \
your.h \
headers.h \
of.h \
interest.h
QT += xml
# etc., etc.
and core.pro
# core.pro
TEMPLATE = lib
CONFIG += dll thread create_prl
QT += network xml xmlpatterns sql
include(../build.pri)
HEADERS += \
headers.h
SOURCES += sources.cpp \
many_of_them.cpp
TARGET = core
# etc., etc.
(note the include(../build.pri)
), and then make your main project app.pro
as a subdirs
project with core
and gui
as components of application, and test.pro
with obligative core
and as many tests as you want.
Upvotes: 3