[CMake] add_custom_target dependency list issue
Szilárd Páll
szilard.pall at cbr.su.se
Sun Sep 26 15:31:20 EDT 2010
I figured out something that makes me even more puzzled. The following
does _not_ work as expected::
set(DEPS "dep1 dep2 dep3")
add_dependencies(foo bar
${DEPS})
Target "foo" gets only dependent on bar and not dep1,2,3. On the other
hand, manually listing the latter instead of using the DEPS variable
works as well as adding them one-by-one in a loop (where also a
variables is used).
This seems to be _extremely_counterintuitive! Is there some sort of
CMake black-magic or basic rule that I don't know of?
--
Szilárd
On Sun, Sep 26, 2010 at 9:09 PM, Szilárd Páll <szilard.pall at cbr.su.se> wrote:
>> The DEPENDS option of ADD_CUSTOM_TARGET() is meant for file-level
>> dependencies only; use ADD_DEPENDENCIES() for target-level ones.
>
> Silly mistake, thanks for pointing it out. However, even if I add
> target dependencies using ADD_DEPENDENCIES() it seems to take into
> account only the dependent the binary targets (bar, see above), but
> the custom ones (dep1,2,3) are completely ignored. What could be still
> wrong?
>
> Also, strangely enough, if I list the binary target in the
> add_custom_target's DEPENDS section (like in my initial example), it
> does work. Is this just because I am lucky enough that the the
> dependency itself is a binary with the same name as the target I
> actually intended to refer to?
>
> --
> Szilárd
>
More information about the CMake
mailing list