Le Wed, 3 Dec 2008 10:09:56 -0600,
"Robert Dailey" <[EMAIL PROTECTED]> a écrit :

> On Tue, Dec 2, 2008 at 3:00 PM, Alexander Neundorf
> <[EMAIL PROTECTED]>wrote:
> 
> > It expects a variable which holds a list:
> >
> > set(myList foo bar)
> > list( LENGTH myList listlen )
> > message( ${listlen} )
> >
> > (didn't test or check docs, but I think that should be it)
> 
> 
> Why did you do:
> 
> list( LENGTH myList listlen )
> 
> instead of:
> 
> list( LENGTH ${myList} listlen ) 
> 
> This seems pretty inconsistent with how I pass variables into
> functions in other places, like message() for example.

Nope it is consistent.
"list" command is working on the "object" list whereas
message is generally interested in the "value" of your "object".

There is the same idea/issue/feature with "if" command which can
work either on content (i.e. value) or on the variable itself (object).

if(variable STRLESS string)
if(string STRLESS string)

I do attach a file for playing with value and object try
to execute it with cmake -P  playing_with_value_and_object.cmake.

You may eventually find it interesting.


-- 
Erk
# classic VAR
SET(VALUE "Value")
SET(NAME  "Name")
# use value for VAR name
SET(Toto.${VALUE} "another value")
SET(Toto.${NAME}  "nice name")

# use those in message
MESSAGE(VALUE=${VALUE})
MESSAGE(NAME=${NAME})
MESSAGE(Toto.${VALUE}=${Toto.${VALUE}})
MESSAGE(Toto.${NAME}=${Toto.${NAME}})

# Now with list
SET(MyList1 a b c)
SET(MyList2 a d)

IF(UNIX) 
  SET(C MyList1)
ELSE(UNIX)
  SET(C MyList2)
ENDIF(UNIX)

LIST(LENGTH ${C} len)
MESSAGE(len = ${len})
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to