Notes |
|
(0033147)
|
Brad King
|
2013-05-28 16:49
|
|
Since lists are ;-separated one can just do
string(REPLACE ";" "${mysep}" concatenated "${list}") |
|
|
(0033148)
|
Brad King
|
2013-05-28 16:52
|
|
This is better discussed on the mailing list first. Resolving as "suspended" for now.
|
|
|
(0033150)
|
mwoehlke
|
2013-05-29 17:12
|
|
Without some sort of non-trivial additional processing, string(REPLACE) mishandles items with (escaped) ';'s in them.
Consider:
set(items
hello
"the\;world"
is on fire
)
string(REPLACE ";" " " replace_quoted "${items}")
message(STATUS "replace quoted: '${replace_quoted}'")
string(REPLACE ";" " " replace_list ${items})
message(STATUS "replace list: '${replace_list}'")
set(join_items)
foreach(item ${items})
if(join_items)
set(join_items "${join_items} ${item}")
else()
set(join_items "${item}")
endif()
endforeach()
message(STATUS "join items: '${join_items}'")
set(join_list)
foreach(item IN LISTS items)
if(join_list)
set(join_list "${join_list} ${item}")
else()
set(join_list "${item}")
endif()
endforeach()
message(STATUS "join list: '${join_list}'")
...both of the tries using string(REPLACE) give a result other than is desired (and different from each other, as well). The versions using foreach both give the desired result. |
|
|
(0033151)
|
mwoehlke
|
2013-05-29 17:17
|
|
Actually, the other main reason I would like this is to do things like:
join(output ", "
"item1"
"item2"
...
)
...which is how I am using it in the most recent project. |
|
|
(0042291)
|
Kitware Robot
|
2016-06-10 14:28
|
|
Resolving issue as `moved`.
This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page. |
|