I'm looking at the qmake documentation, but I'm having troulbe seeing how I can make qmake work in the following context.

I'm having a range of libraries and some executables, all in separate projects. I want each project do mark the other as a dependency, and build it if needed. What would be even better if projects could export some of their properties, like include file paths, to project that depend on them, so that it's sufficient to just specify the project dependency to have everything set to build the project.

for example, consider the following directory structure:

Qt Code:
  1. root
  2. |-- app1
  3. |-- app2
  4. |-- lib1
  5. | |-- include (lib1 public include files)
  6. | ...
  7. | `-- lib (lib1 target build directory, containing the built libraries)
  8. `-- lib2
  9. |-- include (lib2 public include files)
  10. ...
  11. `-- lib (lib2 target build directory, containing the built libraries)
To copy to clipboard, switch view to plain text mode 

and for the sake of the example, app1 would depend on lib2, which in turn depends on lib1. app2 depends on lib1 alone.

as far as I got, one has to manually add the following to app1's project files:

Qt Code:
  1. INCLUDEPATH += ../lib2/include ../lib1/include
  2. LIBS += -L../lib2/lib -llib2 -L../lib1/lib -llib1
To copy to clipboard, switch view to plain text mode 

and for app2:

Qt Code:
  1. INCLUDEPATH += ../lib1/include
  2. LIBS += -L../lib1/lib -llib1
To copy to clipboard, switch view to plain text mode 

and for lib2:

Qt Code:
  1. INCLUDEPATH += ../lib1/include
  2. LIBS += -L../lib1/lib -llib1
To copy to clipboard, switch view to plain text mode 


why I'd be looking for a qmake-based solution, that would enable just noting an external library are the following:

  • to have a single point for marking dependencies (vs. marking includepath, libs, etc. all separately, which is prone to human error and a duplication of paths)
  • to propagate dependency tree information (e.g. in the above example, lib2 could propagate the dependency details for lib1 up to app1)
  • makeing full dependency-aware rebuilds (e.g. changes in lib1 could trigger a rebuild in app1, lib2 and app2 as well)


with a possible qmake-based solution, would could use the following in app1:

Qt Code:
  1. DEPENDS_ON = ../lib2/lib2.pro
To copy to clipboard, switch view to plain text mode 

for lib2:

Qt Code:
  1. DEPENDS_ON = ../lib1/lib1.pro
  2. EXPORT_INCLUDEPATH += include
  3. EXPORT_LIBS += -llib1
To copy to clipboard, switch view to plain text mode 

for lib1:

Qt Code:
  1. EXPORT_INCLUDEPATH += include
  2. EXPORT_LIBS += -llib2
To copy to clipboard, switch view to plain text mode 


maybe this is all there, and I'm just not finding it in the documentation? maybe none if this is there?