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:
root
|-- app1
|-- app2
|-- lib1
| |-- include (lib1 public include files)
| ...
| `-- lib (lib1 target build directory, containing the built libraries)
`-- lib2
|-- include (lib2 public include files)
...
`-- lib (lib2 target build directory, containing the built libraries)
root
|-- app1
|-- app2
|-- lib1
| |-- include (lib1 public include files)
| ...
| `-- lib (lib1 target build directory, containing the built libraries)
`-- lib2
|-- include (lib2 public include files)
...
`-- 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:
INCLUDEPATH += ../lib2/include ../lib1/include
LIBS += -L../lib2/lib -llib2 -L../lib1/lib -llib1
INCLUDEPATH += ../lib2/include ../lib1/include
LIBS += -L../lib2/lib -llib2 -L../lib1/lib -llib1
To copy to clipboard, switch view to plain text mode
and for app2:
INCLUDEPATH += ../lib1/include
LIBS += -L../lib1/lib -llib1
INCLUDEPATH += ../lib1/include
LIBS += -L../lib1/lib -llib1
To copy to clipboard, switch view to plain text mode
and for lib2:
INCLUDEPATH += ../lib1/include
LIBS += -L../lib1/lib -llib1
INCLUDEPATH += ../lib1/include
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:
DEPENDS_ON = ../lib2/lib2.pro
DEPENDS_ON = ../lib2/lib2.pro
To copy to clipboard, switch view to plain text mode
for lib2:
DEPENDS_ON = ../lib1/lib1.pro
EXPORT_INCLUDEPATH += include
EXPORT_LIBS += -llib1
DEPENDS_ON = ../lib1/lib1.pro
EXPORT_INCLUDEPATH += include
EXPORT_LIBS += -llib1
To copy to clipboard, switch view to plain text mode
for lib1:
EXPORT_INCLUDEPATH += include
EXPORT_LIBS += -llib2
EXPORT_INCLUDEPATH += include
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?
Bookmarks