[CMake] [BUG] add_custom_command(TARGET ...) can't see in scope target
Dan Liew
dan at su-root.co.uk
Tue Aug 4 22:49:17 EDT 2015
>> 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.
>
>
> I think it is sensible that the definition of a target is scoped to one
> single directory.
> Where the definition of a target consists of e.g. sources, properties,
> dependencies and custom commands related to the target.
>
> You can reference/query global targets in other directories but you can not
> change them.
It seems sensible from a safety standpoint (preventing targets from
accidentally being modified from other directories) but it also
limiting in that
it prevents certain directory layouts (like the one I tried in my example).
More information about the CMake
mailing list