View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0014177 | CMake | CMake | public | 2013-05-28 16:04 | 2016-06-10 14:31 | ||||
Reporter | mwoehlke | ||||||||
Assigned To | Kitware Robot | ||||||||
Priority | normal | Severity | feature | Reproducibility | always | ||||
Status | closed | Resolution | moved | ||||||
Platform | OS | OS Version | |||||||
Product Version | CMake 2.8.10.2 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0014177: RFE: built-in to join list of strings | ||||||||
Description | On at least two projects I have found myself writing a simple CMake macro/function to take a list of strings and concatenate them into one string with a narbitrary separator. This seems like very basic functionality. Would you consider adding a built-in function for this? (Maybe as an additional sub-command to either STRING or LIST?) | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | ||||||
|
Relationships |
Notes | |
(0033147) Brad King (manager) 2013-05-28 16:49 |
Since lists are ;-separated one can just do string(REPLACE ";" "${mysep}" concatenated "${list}") |
(0033148) Brad King (manager) 2013-05-28 16:52 |
This is better discussed on the mailing list first. Resolving as "suspended" for now. |
(0033150) mwoehlke (developer) 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 (developer) 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 (administrator) 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. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2013-05-28 16:04 | mwoehlke | New Issue | |
2013-05-28 16:49 | Brad King | Note Added: 0033147 | |
2013-05-28 16:52 | Brad King | Note Added: 0033148 | |
2013-05-28 16:52 | Brad King | Status | new => resolved |
2013-05-28 16:52 | Brad King | Resolution | open => suspended |
2013-05-29 17:12 | mwoehlke | Note Added: 0033150 | |
2013-05-29 17:12 | mwoehlke | Status | resolved => feedback |
2013-05-29 17:12 | mwoehlke | Resolution | suspended => reopened |
2013-05-29 17:17 | mwoehlke | Note Added: 0033151 | |
2013-05-29 17:17 | mwoehlke | Status | feedback => new |
2013-05-30 08:03 | Brad King | Status | new => backlog |
2013-05-30 08:03 | Brad King | Resolution | reopened => open |
2013-11-19 12:33 | mwoehlke | Relationship added | has duplicate 0014583 |
2016-06-10 14:28 | Kitware Robot | Note Added: 0042291 | |
2016-06-10 14:28 | Kitware Robot | Status | backlog => resolved |
2016-06-10 14:28 | Kitware Robot | Resolution | open => moved |
2016-06-10 14:28 | Kitware Robot | Assigned To | => Kitware Robot |
2016-06-10 14:31 | Kitware Robot | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |