[CMake] add_custom_target dependency list issue
Michael Hertling
mhertling at online.de
Sat Sep 25 21:58:06 EDT 2010
On 09/26/2010 02:34 AM, Szilárd Páll wrote:
> Hi,
>
> I implemented a custom target which depends on several other targets,
> including some that I generate beforehand as custom targets and
> collect their names in a variable. However, this seems to behave in a
> strange way if I list these dependencies like this:
>
> add_custom_target(foo COMMAND [...]
> DEPENDS bar ${MORE_DEPENDENCIES}),
>
> where ${MORE_DEPENDENCIES} contains space separated list of e.g "dep1 dep2 dep3"
>
> The error I get with generated makefiles is:
>
> make[3]: *** No rule to make target `path_to_bar/bar dep1 dep2 dep3',
> needed by [...] Stop.
>
> The strange thing is that even if I explicitly list the dependency
> names instead of passing them through the value of the
> MORE_DEPENDECIES variable, I get an error that there is no rule to
> make the respective target:
>
> make[3]: *** No rule to make target `dep1', needed by [...] Stop.
>
> What am I doing wrong? The custom targets dep1,2,3 are generated
> right before "foo", and all of them seem to work (make dep1,2,3
> succeeds).
The DEPENDS option of ADD_CUSTOM_TARGET() is meant for file-level
dependencies only; use ADD_DEPENDENCIES() for target-level ones.
Regards,
Michael
More information about the CMake
mailing list