How to properly configure dependencies in Subdirs project?
Resurr3ction last edited by
There are several ways how to go about dependencies in Qt Creator. With regular projects there is a dependency tab under the Project configuration. With
Subdirsproject there is a
.dependsparameter one can give to each project. However
Subdirsproject can contain other
Subdirsprojects and the dependencies can thus span across these with a project under sub-sub-project depends on another that is in different sub-sub-project:
Master Subdirs L--- Subdirs 1 L--- Project 1 L--- Subdirs 2 L--- Project 2 //depends on Project 1
There are two issues with this setup:
One cannot set the dependencies in
Master Subdirsbecause neither
Project 1are known to it (similarly for
Subdirs 2). The only thing that can be set is whether
Subdirs 2depends on
Subdirs 1but that will not help if there are mutual dependencies.
Project 2on its own it does not know about its dependencies set in the
Subdirsproject and since projects in
Subdirscannot have regular dependencies set in Project tab one cannot build it automatically and must either build everything or build the dependencies manually before the actual project.
Are there any solutions to these problems? No. 1 can be solved with not using child
Subdirsbut no. 2 is still an issue regardless.
I've got one hint, although it may not be exactly what you are looking for. Add this in your .pro file:
As described here, the "ordered" option will ensure that the subprojects are built in the same order they are listed in SUBDIRS variable. So it could help you rearrange the projects so that they are build in the order that satisfies all dependencies.
Good info, @SGaist thanks :-) That link goes straight to my bookmarks.