[CMake] add_custom_commmand TARGET is unknown

Nils Gladitz nilsgladitz at gmail.com
Thu Apr 16 16:34:19 EDT 2015


On 16.04.2015 22:25, Daniel Dilts wrote:
> You can only add commands to a target that was defined in the current 
> directory?  So, I would have to have a new target for each directory 
> and then have a target that depends on all of those targets?

I don't know your use case so I can not comment on what you have to do 
or should do.

Disregarding your use case ... to make it "work" (to stop cmake from 
complaining) all you have to do is move creation of the custom commands 
into the directory where the target is defined. The information required 
to create these commands may come from different scopes (e.g. you could 
maintain variables or global properties with the information required to 
construct the appropriate commands).

Nils


More information about the CMake mailing list