I have a structure like follows:

Qt Code:
  1. include
  2. src
  3. src/src.pro
  4. src/<project>/<project stuff>
  5. src/<project group>/<project>/<project stuff>
  6. lib
  7. lib.debug
To copy to clipboard, switch view to plain text mode 

I essentially have a number of widgets/objects/etc that I'd like to bundle into a series of static libraries for other projects to link against. I'd also like this to be centralized so the developer only has to do 'qmake && make' once and all the projects (or a sub-set thereof) get built and put into the 'lib' (for release) and 'lib.debug' (for debug) as needed. Then the main application can just search that one location during its link for its required libraries that I am providing.

I discovered the 'subdirs' template and it works very well, for the most part - allowing me to have a single point to compile the various projects. (cool). However, I am having some trouble with the release/debug side of doing the build.

I added the following to one of the sub-projects:

Qt Code:
  1. CONFIG += debug_and_release
  2. CONFIG(debug,debug|release) {
  3. DESTDIR = ../../lib.debug
  4. } else {
  5. DESTDIR = ../../lib
  6. }
To copy to clipboard, switch view to plain text mode 

However, when I ran 'qmake && make' it only put binaries in the 'lib' folder - not the 'lib.debug' folder. I also could not do a 'make debug' or 'make release' at the parent (e.g. where src.pro is located). Is there any way to correct this? I am new to do all of this in qmake this way. (I have previously written scripts to manage VC++ projects in a lot more complicated manner that retrieved and built dependencies; but new to doing this part in Qt.)

Also, if possible, I'd rather have a line like:

Qt Code:
  1. DESTDIR = ${baseDir}/lib
To copy to clipboard, switch view to plain text mode 

instead of

Qt Code:
  1. DESTDIR = ../../lib
To copy to clipboard, switch view to plain text mode 

as I may have different depths involved and it would make building/modifying each project's pro file a lot simpler. Is there any variable I can use in this manner?