Sorry for the top-posting, I&#39;m using my phone to send this.<br><br>The unique names in each subdir are not an acceptable solution for me. <br><br>Also, the project builds on Linux only, where gmake is fine.<br><br>Thanks,<br>WK<br><br>----- Reply message -----<br>From: &quot;Matthew Woehlke&quot; &lt;matthew.woehlke@kitware.com&gt;<br>To: &lt;cmake@cmake.org&gt;<br>Cc: &lt;public-cmake-wChDC6UyXvPYtjvyW6yDsg@plane.gmane.org&gt;<br>Subject: [CMake] Building all tests in parallel (whole subtrees)<br>Date: Thu, Jan 24, 2013 01:07<br><br><br>On 2013-01-23 18:08, Wojciech Knapik wrote:<br>&gt; I set up targets that build the unit test executables and<br>&gt; marked them with EXCLUDE_FROM_ALL, because I don&#39;t want to tie building<br>&gt; them to building the application code. Now I need a way to build and run<br>&gt; these tests en masse, since there are too many to do it one at a time.<br>&gt;<br>&gt; Ideally I&#39;d like to have a make target, that I could call to build all<br>&gt; unit tests in the current directory and below *in*parallel*.<br><br>I&#39;m not sure if this is possible (or at least feasible)... different <br>generators may or may not have the concept of targets in directories. I <br>think you would need to create a uniquely named target per directory.<br><br>Now, assuming you are okay creating one top-level target to build <br>everything, it&#39;s easy:<br><br>root/CMakeLists.txt:<br>add_custom_target(all_tests)<br><br>root/some_subdir/test/CMakeLists.txt:<br>add_dependency(all_tests my_test_executable)<br><br>The tests will have the same ability to be built in parallel as any <br>other targets.<br><br>If you are using Makefiles, this *might* &#39;just happen&#39; to do what you <br>want for directory-level granularity, but it won&#39;t work with other <br>generators (e.g. ninja, MSVS, etc.). Otherwise, you can probably figure <br>out how to extend the above idea to directory-level targets.<br><br>(On an unrelated note, I would suggest looking at ninja; it&#39;s a whole <br>bunch faster than make, nmake, or MSVS.)<br><br>-- <br>Matthew<br><br>--<br><br>Powered by www.kitware.com<br><br>Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html<br><br>Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://www.cmake.org/mailman/listinfo/cmake<br>