[CMake] list( LENGTH ) problem

Maik Beckmann beckmann.maik at googlemail.com
Tue Dec 2 15:45:57 EST 2008


Am Dienstag, 2. Dezember 2008 schrieb Robert Dailey:
> Hi,
>
> I execute the following CMake code:
>
> list( LENGTH "foo;bar" listlen )
> message( ${listlen} )
>
> However, this results in the value "0" to be printed. I expect this to
> print "2". What am I doing wrong?

list takes a list-name, so 
  list( LENGTH "foo;bar" listlen )
looks for a list named "foo;bar", doesn't find it and sets listlen to 0.
Try 
  set(mylist "foo;bar")
  list(LENGTH mylist listlen)
  message(${listlen})


More information about the CMake mailing list