[CMake] bug ? changed behaviour of ADD_CUSTOM_COMMAND

Brad King brad.king at kitware.com
Fri Sep 16 10:10:42 EDT 2005


Alexander Neundorf wrote:
>>Von: Brad King <brad.king at kitware.com> 
>>
> 
> ... 
> 
>>The original behavior was not intentional.  The DEPENDS option of  
>>ADD_CUSTOM_TARGET is meant for dependencies on the outputs of  
>>ADD_CUSTOM_COMMAND.  It was just coincidence that the generated 
> 
> makefile  
> 
>>had the right dependencies, and I don't think it worked in other 
>>generators. 
>> 
>>The way to add dependencies between top-level targets is with the  
>>ADD_DEPENDENCIES command: 
>> 
>>ADD_CUSTOM_TARGET( world echo "world" ) 
>>ADD_CUSTOM_TARGET( hello echo "hello" ) 
>>ADD_DEPENDENCIES( world hello ) 
> 
>  
> Ah, ok. 
> Is it intentional that the following works ? 
>  
> ADD_CUSTOM_TARGET(foo COMMAND ps COMMAND ls COMMAND echo "hello world") 
>  
> i.e. that I can add multiple commands for one custom target ? I didn't 
> knew that, it's cool. 

Yes, that feature was added between 2.0 and 2.2.  It is also included in 
the documentation of the ADD_CUSTOM_* commands, though it looks like the 
ADD_CUSTOM_TARGET documentation should be clarified.

-Brad


More information about the CMake mailing list