Originally Posted by
Marco Medri
How did you solve it in the end?
Using an include() file...
# master.pro
TEMPLATE = subdirs
CONFIG += ordered
include(master.pri)
message("Master PROJECT_ROOT_DIRECTORY: "$${PROJECT_ROOT_DIRECTORY})
# project subdirs
SUBDIRS += project1
# master.pro
TEMPLATE = subdirs
CONFIG += ordered
include(master.pri)
message("Master PROJECT_ROOT_DIRECTORY: "$${PROJECT_ROOT_DIRECTORY})
# project subdirs
SUBDIRS += project1
To copy to clipboard, switch view to plain text mode
# master.pri
PROJECT_ROOT_DIRECTORY = $${PWD}
# master.pri
PROJECT_ROOT_DIRECTORY = $${PWD}
To copy to clipboard, switch view to plain text mode
# project1/project1.pro
include(../master.pri)
TEMPLATE = app
TARGET = project1
INCLUDEPATH += .
# Input
SOURCES += main.cpp
# output 'PROJECT_ROOT_DIRECTORY ' contents
message("$${TARGET} PROJECT_ROOT_DIRECTORY: "$${PROJECT_ROOT_DIRECTORY})
# project1/project1.pro
include(../master.pri)
TEMPLATE = app
TARGET = project1
INCLUDEPATH += .
# Input
SOURCES += main.cpp
# output 'PROJECT_ROOT_DIRECTORY ' contents
message("$${TARGET} PROJECT_ROOT_DIRECTORY: "$${PROJECT_ROOT_DIRECTORY})
To copy to clipboard, switch view to plain text mode
Output:
chrisw@newton /tmp/master $ qmake
Info: creating stash file /tmp/master/.qmake.stash
Project MESSAGE: Master PROJECT_ROOT_DIRECTORY: /tmp/master
chrisw@newton /tmp/master $ make
cd project1/ && ( test -e Makefile || /usr/lib64/qt5/bin/qmake -o Makefile /tmp/master/project1/project1.pro ) && make -f Makefile
Project MESSAGE: project1 PROJECT_ROOT_DIRECTORY: /tmp/master
make[1]: Entering directory '/tmp/master/project1'
...
make[1]: Leaving directory '/tmp/master/project1'
chrisw@newton /tmp/master $ qmake
Info: creating stash file /tmp/master/.qmake.stash
Project MESSAGE: Master PROJECT_ROOT_DIRECTORY: /tmp/master
chrisw@newton /tmp/master $ make
cd project1/ && ( test -e Makefile || /usr/lib64/qt5/bin/qmake -o Makefile /tmp/master/project1/project1.pro ) && make -f Makefile
Project MESSAGE: project1 PROJECT_ROOT_DIRECTORY: /tmp/master
make[1]: Entering directory '/tmp/master/project1'
...
make[1]: Leaving directory '/tmp/master/project1'
To copy to clipboard, switch view to plain text mode
Bookmarks