I have the following *.pro files :
the one which heads the solution
# head - pro file :
TEMPLATE = subdirs
CONFIG = qt thread ordered
# save root directory
PROJECT_ROOT_DIRECTORY = $$_PRO_FILE_PWD_
message("Master pro file path : ["$${PROJECT_ROOT_DIRECTORY}"]") // output : "Master pro file path : [/Path/To/Directory]"
# project subdirs
SUBDIRS += PROJECT1
and
# PROJECT1 - pro file :
TEMPLATE = app
# etc.
# output 'PROJECT_ROOT_DIRECTORY ' contents
message("Master pro file path : "$${PROJECT_ROOT_DIRECTORY}) // output : "Master pro file path : []"
How do I pass variables between the 2 pro files (here the variable is PROJECT_ROOT_DIRECTORY) ?
Edit :
This is the same question as this this one, but I don’t see how the “another option is to” answer can help me.
You could put the variable definitions in a
.prifile, which you then include in all.profiles you want. Note that you need to tell the.profiles in your subdirectories the path where to find the.prifile.head.pro:
config.pri:
project1/project1.pro: