Qmake, subdirs, libraries



  • I'm trying to figure out if there's a good way to improve my qmake build, which right now has some issues.

    I have several repositories, each of which builds either a library or an executable. Each of them has a corresponding .pro file. What I would ideally like to do is tell an executable-making .pro which library-making .pro files it depends on.

    I tried setting "project dependencies" in my QTCreator session. That helped somewhat but didn't really solve the issue. Next, I tried explicitly adding the build directory and target of each library-making pro to the LIBS variable of the executable-making pro. This allowed the build to work.

    However, there's still an issue. If I modify a file in one of the libraries, the executable is not automatically re-linked as it should be.

    I have read about the SUBDIRS template in qmake. I have my doubts that this is what I want. I don't fully understand it---is there comprehensive documentation somewhere? But it seems like it's not quite what I need, because I want to be able to have multiple executables all depending on the same libraries, and it's not clear if SUBDIRS allows this.

    Any thoughts?


  • Moderators

    Subdirs is just a template that allows you to have several separate .pro files bundled together: you run qmake once for the root .pro file, and the rest is built automatically.

    For a huge example, simply check out Qt code: all modules are based on qmake SUBDIRS. For a smaller example, take a look at my "QEasyShell":https://github.com/sierdzio/qeasyshell.

    If you want other projects be rebuilt when you update a dependency, you need to use DEPENDPATH variable.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.