[CMake] managing lists with space separated elements

Piotr Dobrogost pd at opensource.dobrogost.pl
Sat Apr 11 10:19:19 EDT 2009


Bill Hoffman wrote:

> Piotr Dobrogost wrote:
>> Bill Hoffman wrote:
>>
>>> There is no such thing as a list with spaces in CMake, that is a string.
>>>  So, no there is no way to use the list command on strings directly. You
>>> could use string(replace ) to do what you are trying to do.
>>
>> I've seen people already asking about this feature.
>> Wouldn't that be useful to have this?
>> I don't see any reason why not to support both kinds of commonly used
>> lists instead of only one.
>>
>>
> But, it is not a list....   Why not use string replace?

Because it is a list in its very nature. The fact we _can_ treat it as
string doesn't change its inherent identity. That's even reflected when
you name such variables. How would you name
${CMAKE_C_STANDARD_LIBRARIES} variable? It's a _list_ of some libraries.
It's neither a set nor a graph nor a tree :) It's simply a list.

Every structure can be treated like a string because every structure can
be serialized. But it doesn't help to understand this structure's
inherent properties when we look at it mainly or only as a string. It
doesn't help to manage such structure as well.

Take for an example a localization string. The main properties we are
interested in are the language and maybe string's length. We don't
usually do any operations on its words. And because of this it's _more_
a string than a list. On the other hand we very often have to add/remove
elements of variables like ${CMAKE_C_STANDARD_LIBRARIES}. And because of
this it's _more_ a list than a string.

Bill, would you mind be so kind and show this topic to other people
writing cmake in Kiteware? I'd like to know what they think about this.

I'd like to know what others on this list think about it as well. So if
you're reading this post please tell us what you think.


-- 
Piotr Dobrogost
*** curlpp.org - c++ wrapper for libcurl ***



More information about the CMake mailing list