subdirs with more than one level
-
I am trying to construct a project file. I can see the logic of the subdirs template, but the docs only seem to describe a simple case where the app depends upon lib and lib2.
TEMPLATE = subdirs
SUBDIRS =
lib2 \ # sub-project names
lib
app
lib2.subdir = src/lib2
lib.subdir = src/lib
app.subdir = src/app
app.depends = lib lib2What if app depends on lib and lib depends upon lib1 and lib2? Do I add the line in bold
TEMPLATE = subdirs
SUBDIRS =
lib2 \
lib1 \
lib
app
lib1.subdir = src/lib1
lib2.subdir = src/lib2
lib.subdir = src/lib
app.subdir = src/app
app.depends = lib lib2
lib.depends = lib1 lib2 -
@aethelnorn said in subdirs with more than one level:
app.depends = lib lib2
Should have been
app.depends = lib -
OK thanks for confirming that.
And that is twice today I have been threatened with kitten deaths. But think of all the fledgling birds I could save.......
Aethelnorn
-
lib1.subdir = src/lib1
lib2.subdir = src/lib2
lib.subdir = src/libPlease note that you dont need these lines if the pro file is directly in src and named src.pro
Having multiple nested pro files helps to reduce redundany. Just my 2 cent...
-
@aha_1980 Not sure I understand... and perhaps I should (I have this perverse need to know what the tool is doing under the covers, and feel uneasy if I don't)
What I think you are saying (and pleae correct me if I am wrong) is:
If I have a sub directory 'src' qmake(?) will automatically search it and if it finds a 'src.pro' will automatically include it.And further, that I do not need to define all my sub-targets in the top .pro file, but can create a 'tree' of .pro files with targets defined at the lowest appropriate level.
-
What I think you are saying (and pleae correct me if I am wrong) is:
If I have a sub directory 'src' qmake(?) will automatically search it and if it finds a 'src.pro' will automatically include it.If you reference it with
SUBDIRS+=src
from the top-level, yes.And further, that I do not need to define all my sub-targets in the top .pro file, but can create a 'tree' of .pro files with targets
Exactly :)
-
@aethelnorn you can browse qtbase at http://code.qt.io/cgit/qt/qtbase.git/tree/src to see it in action...