[cmake-developers] [CMake] [BUG] add_custom_command(TARGET ...) can't see in scope target
Nils Gladitz
nilsgladitz at gmail.com
Tue Aug 4 17:24:32 EDT 2015
On 04.08.2015 23:15, Dan Liew wrote:
>> 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?
As far as I know it has always been this way.
> 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.
Nils
More information about the cmake-developers
mailing list