[CMake] add_custom_target problem

Michael Wild themiwi at gmail.com
Wed Jun 9 12:05:30 EDT 2010


On 9. Jun, 2010, at 17:47 , Hariharan Iyer wrote:

> This may not be only because of using add_custom_target, but I have the following problem. I have a custom target that depends on a generated file, as:
> add_custom_target(foo DEPENDS bar)
> 
> where "bar" is a generated file, generated using add_custom_command.
> 
> If I build the "foo" target by itself, it builds perfectly. However, if I build the default "all" target, "foo" does not get built. My top-level listfile has add_subdirectories(foo), and the custom target line above is present in the listfile for the "foo" directory.
> 
> What am I missing or doing wrong?
> 
> Regards,
> Hari
> 

Read the docs more carefully? ;-) You need to add ALL as an option to the add_custom_target command.

Michael



More information about the CMake mailing list