Hi Christian, Thank you very much for your reply.
I am sorry for not stating my question clearly. Perhaps I should use isStandalone instead of isSubProject, my motivation is to facilitate users of my libraries which are stored in individual git repository. The main product of my qbs project is a library, other products are examples and tests. To reduce build time for whole source tree, I prefer examples and tests of my project are not built if my qbs project is not a standalone project. That means my qbs project is added by other projects as a git module. To save time and code of users of my projects, I prefer users of my projects do not need to override properties of my qbs project in order not to build examples and tests. Therefore I need a property to know whether my qbs project is a standalone project. By the way, why path is undocumented? Is it because path is private? Why not make it public? Should path be renamed? path being a property name ( https://github.com/qbs/qbs/blob/master/src/lib/corelib/buildgraph/buildgraph.cpp#186 line#186) and a type name is a bit confusing I think. Thank you again, Vincent On Thu, 18 Jul 2019 at 00:08, Christian Kandeler <[email protected]> wrote: > On Wed, 17 Jul 2019 23:25:49 +0800 > Vincent Hui <[email protected]> wrote: > > > I want to check whether a project is a subproject of another project. If > a > > project is not a subproject, its examples and tests are built. If a > project > > is a subproject, its examples and tests are not built. > > Declare a property in your project that controls this. Override this > property from the containing project. Done. > > > It seems that the method for checking whether a project is a subproject > is > > undocumented. > > There is no such method, and I don't think it would be a good idea to have > it. > > > I came up with a method to check whether a project is a subproject. It is > > checking whether sourceDirectory is equal to path. I tried a simple > > project, my method works. > > > > " > > Project { > > readonly property bool isSubProject: (sourceDirectory === path) ? > false > > : true; > > ...... > > " > > > > Can my method work in complicated projects? > > No. The parent project could be in the same directory. > > > Christian > _______________________________________________ > Qbs mailing list > [email protected] > https://lists.qt-project.org/listinfo/qbs >
_______________________________________________ Qbs mailing list [email protected] https://lists.qt-project.org/listinfo/qbs
