qt - Passing variables between *.pro files -
i have following *.pro files :
the 1 heads 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 pass variables between 2 pro files (here variable project_root_directory
) ?
edit :
this same question this one, don't see how "another option to" answer can me.
you put variable definitions in .pri
file, include in .pro
files want. note need tell .pro
files in subdirectories path find .pri
file.
head.pro:
# head - pro file : template = subdirs config = qt thread ordered # configuration include(config.pri) message("master pro file path : ["$${project_root_directory}"]") # output : "master pro file path : [/path/to/directory]" # project subdirs subdirs += project1
config.pri:
# save root directory project_root_directory = $$pwd // not $$_pro_file_pwd_!
project1/project1.pro:
# project1 - pro file : template = app # configuration include(../config.pri) # note need put "../" before .pri path message("master pro file path : ["$${project_root_directory}"]") # should output : "master pro file path : [/path/to/directory]"
Comments
Post a Comment