[CMake] problem with add_custom_command / add_custom_target in different directories
Brad King
brad.king at kitware.com
Mon Mar 30 08:40:34 EDT 2009
James Bigler wrote:
> I filed a documentation bug:
> http://public.kitware.com/Bug/view.php?id=8815
I've committed documentation and updated the bug entry.
> BTW, is there a particular reason why custom commands are only
> registered in the directory where they appear? They seem kind of like
> the little brother of a target, and targets are global.
It was developed that way historically. At the time they were created
they literally mapped to
OUTPUT: DEPENDS
COMMAND
rules in makefiles, and CMake used directory-level recursive make so
the rules could only work in the same directory. Since then the design
of generated makefiles has totally changed but the behavior was preserved.
There are arguments for and against global scoping of custom commands.
I'd rather not get into a lengthy discussion about it unless someone
volunteers to implement any changes, maintain them, and deal with all
the compatibility issues.
-Brad
More information about the CMake
mailing list