[CMake] add_custom_target dependency list issue

Hendrik Sattler post at hendrik-sattler.de
Mon Sep 27 01:09:54 EDT 2010


Am Montag 27 September 2010, 01:48:38 schrieb Szilárd Páll:
> > No black magic, just cmake's rules about variable contents.
> > Basically CMake has only 1 type of variable value, thats a string. What
> > you created above is a string variable "DEPS" with the value "dep1 dep2
> > dep3", i.e. a single string consisting of 3 words separated by spaces.
> > Some strings are considered to be a list if you use a cmake command that
> > expects a list, these strings need to separate each list entry with a
> > semicolon.If you use
> 
> Actually I knew about the rules on variable contents as well as the
> structure and generation on lists. However I didn't realize that
> 
> set(DEPS "dep1 dep2 dep3")
> add_dependencies(foo bar
>                                ${DEPS})
> 
> is not pretty much the same as:
> 
> add_dependencies(target-name depend-target1
>                    depend-target2 ...),
> 

That's because you got the quotes wrong, must be
  set(DEPS dep1 dep2 dep3)

and _NOT_
  set(DEPS "dep1 dep2 dep3")

for this to work.

HS


More information about the CMake mailing list