[CMake] Building all tests in parallel (whole subtrees)

Wojciech Knapik wmknapik at gmail.com
Wed Jan 23 18:08:45 EST 2013


Hello everyone

I'm just about done switching a project from plain makefiles to CMake
and so far it's been great. 

As one of the last steps, I wanted to add support for building/running
unit tests. I set up targets that build the unit test executables and 
marked them with EXCLUDE_FROM_ALL, because I don't want to tie building
them to building the application code. Now I need a way to build and run
these tests en masse, since there are too many to do it one at a time.

Ideally I'd like to have a make target, that I could call to build all
unit tests in the current directory and below *in*parallel*.

All the ways I found to achieve that, essentially boil down to calling
make with multiple targets and that breaks parallel builds, due to race
conditions - multiple instances of make writing to the same files.

Is there a way to build multiple tests in parallel ?

thanks,
WK


More information about the CMake mailing list