Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. How to properly configure dependencies in Subdirs project?

How to properly configure dependencies in Subdirs project?

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
qt creatordependenciesqmake
4 Posts 3 Posters 6.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Resurr3ctionR Offline
    Resurr3ctionR Offline
    Resurr3ction
    wrote on last edited by
    #1

    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 Subdirs project there is a .depends parameter one can give to each project. However Subdirs project can contain other Subdirs projects 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:

    1. One cannot set the dependencies in Master Subdirs because neither Project 2 or Project 1 are known to it (similarly for Subdirs 2). The only thing that can be set is whether Subdirs 2 depends on Subdirs 1 but that will not help if there are mutual dependencies.

    2. When building Project 2 on its own it does not know about its dependencies set in the Subdirs project and since projects in Subdirs cannot 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 Subdirs but no. 2 is still an issue regardless.

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      I've got one hint, although it may not be exactly what you are looking for. Add this in your .pro file:

      CONFIG+=ordered
      

      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.

      (Z(:^

      1 Reply Last reply
      2
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        In addition to @sierdzio, take a look at this nice article on how to setup dependencies between subprojects.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        4
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          Good info, @SGaist thanks :-) That link goes straight to my bookmarks.

          (Z(:^

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved