On 2013-01-23 18:08, Wojciech Knapik wrote:
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*.
I'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.
Now, assuming you are okay creating one top-level target to build
everything, it's easy:
root/CMakeLists.txt:
add_custom_target(all_tests)
root/some_subdir/test/CMakeLists.txt:
add_dependency(all_tests my_test_executable)
The tests will have the same ability to be built in parallel as any
other targets.
If you are using Makefiles, this *might* 'just happen' to do what you
want for directory-level granularity, but it won'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.
(On an unrelated note, I would suggest looking at ninja; it's a whole
bunch faster than make, nmake, or MSVS.)
--
Matthew
--
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake