[CMake] [BUG] add_custom_command(TARGET ...) can't see in scope target

Dan Liew dan at su-root.co.uk
Tue Aug 4 17:15:46 EDT 2015


> foolib is defined in this CMakeLists.txt:
> https://github.com/delcypher/cmake_add_custom_command_bug/blob/master/lib/CMakeLists.txt
>
> That is the (only) context in which you can extend the definition of the
> target with custom commands.

Since when? I haven't seen that documented anywhere. IMHO this
behavior is counter-intuitive, in general I expect the scope of a
target to not depend on the cmake command I am trying to use. Seeing
as targets seem to be visible globally to all the commands (that I've
used so far) it seems to reasonable to me to expect
add_custom_command() to be able to see these targets too.


More information about the CMake mailing list