Parallel builds with qmake

So you’d like to run make -j4 on your qmake project (or make -j3, make -j2, hi google). Yes, it is possible, but like many things qmake, it is not documented. As usual, the best way to learn about qmake is to see how Qt itself uses it. Actually, I recommend Qt’s own build files as a primary source for qmake information anyway, as if you know where something ought to be in a project then it is faster to find it than going through the formal manual.

In a SUBDIRS project, you may have something like this:

SUBDIRS += library unittest examples

Change it to this:

# depend on variables, not actual directories
SUBDIRS += sub_library sub_unittest sub_examples

# specify the directories and dependencies
sub_library.subdir = library
sub_unittest.subdir = unittest
sub_unittest.depends = sub_library
sub_examples.subdir = examples
sub_examples.depends = sub_library

Have fun.

You're following this conversation Unfollow
Conversation 
Sign in and Post
Tyler Mace moderator

At least in QT4, when you change the name of the SUBDIRS value, you change the name of the directory that it uses to "cd ___" For example, my Makefile would have said in it "cd sub_library" and "qmake sub_library.pro" I believe in my version of qmake, 2.01a, the ".subdir" direction didn't work. My solution, when using your example, was to leave SUBDIRS alone and just call out the depends... SUBDIRS += library unittest examples unittest.depends = library examples.depends = library