<div dir="ltr">On 24 January 2013 00:07, Matthew Woehlke <span dir="ltr">&lt;<a href="mailto:matthew.woehlke@kitware.com" target="_blank">matthew.woehlke@kitware.com</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 2013-01-23 18:08, Wojciech Knapik wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I set up targets that build the unit test executables and<br>
marked them with EXCLUDE_FROM_ALL, because I don&#39;t want to tie building<br>
them to building the application code. Now I need a way to build and run<br>
these tests en masse, since there are too many to do it one at a time.<br>
<br>
Ideally I&#39;d like to have a make target, that I could call to build all<br>
unit tests in the current directory and below *in*parallel*.<br>
</blockquote>
<br></div>
I&#39;m not sure if this is possible (or at least feasible)... different generators may or may not have the concept of targets in directories. I 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 everything, it&#39;s easy:<br>
<br>
root/CMakeLists.txt:<br>
add_custom_target(all_tests)<br>
<br>
root/some_subdir/test/<u></u>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 other targets.<br>
<br>
If you are using Makefiles, this *might* &#39;just happen&#39; to do what you want for directory-level granularity, but it won&#39;t work with other generators (e.g. ninja, MSVS, etc.). Otherwise, you can probably figure 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 bunch faster than make, nmake, or MSVS.)</blockquote><div><br></div><div style>+1 for this, Ninja is _incredibly_ quick compared to mingw32-make / msys make both on full and incremental builds.</div>
<div style>One other advantage is its parallel by default and the output display isn&#39;t mangled like it is with mingw32-make when you use -j &lt;num_cores&gt;</div><div style><br></div><div style><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
Matthew</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/<u></u>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/<u></u>CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/<u></u>listinfo/cmake</a><br>
</div></div></blockquote></div><br>
</div></div>