mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
feat(cmakev2/utilities): add spaces2list function
The spaces2list function is used by some existing components, so it should be added to cmakev2 as well. Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
@@ -501,3 +501,21 @@ function(remove_duplicated_flags FLAGS UNIQFLAGS)
|
|||||||
# Return that string to the caller
|
# Return that string to the caller
|
||||||
set(${UNIQFLAGS} "${FLAGS_LIST}" PARENT_SCOPE)
|
set(${UNIQFLAGS} "${FLAGS_LIST}" PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
#[[
|
||||||
|
spaces2list(<variable>)
|
||||||
|
|
||||||
|
:variable[in,out]: String with space-delimited values.
|
||||||
|
|
||||||
|
Take a variable containing space-delimited values and convert it into a
|
||||||
|
CMake list with semicolon-delimited values.
|
||||||
|
|
||||||
|
Note: do not use this for directories or full paths, as they may contain
|
||||||
|
spaces.
|
||||||
|
|
||||||
|
TODO: look at cmake separate_arguments, which is quote-aware
|
||||||
|
#]]
|
||||||
|
function(spaces2list variable_name)
|
||||||
|
string(REPLACE " " ";" tmp "${${variable_name}}")
|
||||||
|
set("${variable_name}" "${tmp}" PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|||||||
Reference in New Issue
Block a user