PDA

View Full Version : Using qmake to build multiple apps and libs



marchand
9th June 2006, 01:18
Brand new to QT. With my hatred (read that inability to remember syntax) of makefiles, I'm trying to port over a fairly complex hand-build build system to use qmake, one directory at a time.

The current makefile (hand-built) generates a static library and then generates two application binaries. I've managed to get most of the big pieces to build using a qmake generated Makefile, but I can't figure out how to get it to build the static lib first, then two different applications.

I'm sure there are some solutions that involve moving things into subdirectories and giving each binary it's own makefile, but I'd like to avoid those...this project is complicated enough, and changing one simple thing invariably complicates matters down the road, so I've learned to become choosy about rashly making structural decisions without having too much info.

Help much appreciated.

wysota
9th June 2006, 09:08
If you don't move them to separate directories, you'll end up coding most of the makefile yourself, because main features of qmake rely on specifing the template for the build, and I don't think you can have more than one template in a single project file.

marchand
12th June 2006, 17:33
I wound up specifying multiple project files, one for each library/app, and an overall "controlling" project file. The general scheme is that the main project file merely calls the other project files in order, compiling each in turn. I used the subdir directive, but did not need to actually put everything in sub-directories, merely by adding the ".pro" suffix onto the names I put in the SUBDIRS directive.