[CMake] Custom target

Matthew Woehlke matthew.woehlke at kitware.com
Wed Jun 5 14:28:57 EDT 2013


On 2013-06-05 13:06, Ian Liu Rodrigues wrote:
> Is it possible to create a target for all sub-directories with the
> same name? For instance, I want to create a "benchmark" target so that
> every subdir implements a way of bench-marking its own program.

...not really. How would you select which target to build if they all 
have the same name?

Basically, you might be able to get this to work for Makefiles, which 
are sensitive to the current directory, but it won't work for other 
generators.

When I run into situations like this, I use e.g. <name>-benchmark as the 
target names.

-- 
Matthew



More information about the CMake mailing list