I am using CMake with Unix Makefile generator. When I use add_custom_target
it generates the make target only in the CMAKE_CURRENT_BINARY_DIR and the CMAKE_BINARY_DIR.
I found it out by testing it with different layouts of sub-directories.
Is this somewhere documented? Is there a way to create a custom target that works in every target, similar to built-in make clean
?
The rationale behind the question: I have a bunch of unit tests in several unittest
folders. I don't build them with target all
as compiling the tests takes much longer compared to the actual library. With the target unittest
I can build them. I would like to be able to call this from every unittest
subfolder. Preferably it would only build the unit tests located in the current directory and recursively in its sub-directories.