PDA

View Full Version : Differences between SUBDIRS+=*.pro and include(*.pro) statement



sheeeng
11th March 2010, 06:13
Hi,

What is the differences between SUBDIRS+=*.pro and include(*.pro) statement in qmake? I'm trying to pass a DEFINES value into the SUBDIRS statement.

WholeSolution.pro


TEMPLATE = subdirs
CONFIG = ordered
DEFINES *= UNIT_TESTS

SUBDIRS += App/Solution.pro
# include(App/Solution.pro)


App/Solution.pro


contains(DEFINES, UNIT_TESTS) {
SUBDIRS += UnitTest/UnitTest.pro
}


App/Solution.pro does not inherit the UNIT_TESTS definition.

Please advice. Thanks in advance.

wysota
11th March 2010, 07:54
SUBDIRS creates separate projects for each entry each with a target of its own. Include will create a single project with a single target.

The best method to obtain what you want in a clear way is to create a .pri file containing all the statements that are to be shared by each of the projects and include that file from each project.

sheeeng
11th March 2010, 08:19
Thanks, wysota. Nice tip.