Reputation: 27
Have tried to "link" two projects together. So one project knows the other ones classes. One project is the program, the other project is a test program for the first one. So i want the test program to have access to the other ones classes so i can test them.
Both projects are sub projects. They are placed under header project, there folders are beside each other.
Have tried many different ways but with no result.
Head.pro
TEMPLATE = subdirs
SUBDIRS += \
MT \
Test
MT.pri same folder as the program.
INCLUDEPATH += $$PWD
SOURCES += $$PWD/parser.cpp
HEADERS += $$PWD/parser.h
MT.pro
QT += core bluetooth gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = MT
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG += mobility
SOURCES += main.cpp\
mainwindow.cpp \
t.cpp \
parser.cpp \
devicediscovery.cpp
HEADERS += mainwindow.h \
parser.h \
devicediscovery.h \
t.h \
typedefs.h
FORMS += mainwindow.ui
MOBILITY =
INSTALLS += target
DISTFILES += \
MT.pri
Test.pro
include(../MT/MT.pri)
QT += widgets testlib core bluetooth gui
TARGET = tst_testmttest
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
HEADERS += parser.h
SOURCES += tst_testmttest.cpp / parser.cpp
DEFINES += SRCDIR=\\\"$$PWD/\\\"
Upvotes: 1
Views: 125
Reputation: 4029
Use in Test Project:
include(Path/to/OtherProject/file.pri)
Use in Other project
QT += xml
INCLUDEPATH += $$PWD
SOURCES += $$PWD/parser.cpp
HEADERS += $$PWD/parser.h
works fine
Upvotes: 1