Reputation: 428
Hi I have some files in a dir called COMMON_SRC and a .pri file for these src files : Common.pri and two projects in diffrent relative paths to common files. I wanna use only one Common.pri file. Can anyone help me? Can I use some variable in each .pro file which tells the Common.pri file the relative path to project? something like $$PWD ?
Upvotes: 0
Views: 1405
Reputation: 5226
If I understood your question correctly, assume You have a project tree like below:
/
├─common_src
├─test
└─lib
and you have common.pri
in the common_src
folder which points to source files. Imagine you like to include sources in test
and lib
projects.
So, change files path in common.pri
in order to include current path as below:
SOURCES += \
$$PWD/document.cpp
HEADERS += \
$$PWD/document.h
now, include common sources in other projects as this:
lib.pro:
#...
include(../common_src/common.pri)
#...
This trick causes to included path be interpreted as relative to the current project path.
Upvotes: 0