[CMake] list( LENGTH ) problem

Eric NOULARD eric.noulard at gmail.com
Thu Dec 4 14:18:20 EST 2008


Le Wed, 3 Dec 2008 10:09:56 -0600,
"Robert Dailey" <rcdailey at gmail.com> a écrit :

> On Tue, Dec 2, 2008 at 3:00 PM, Alexander Neundorf
> <a.neundorf-work at gmx.net>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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: playing_with_value_and_object.cmake
Type: text/x-cmake
Size: 457 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081204/4df1de73/attachment.bin>


More information about the CMake mailing list