mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
tools: fix make_json_list to return empty json list for empty cmake list
Currently make_json_list() returns '[ "" ]' for empty cmake list. Fix this so empty json list is returned instead. Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
parent
1f06806271
commit
483b7ae763
@ -172,7 +172,12 @@ endfunction()
|
|||||||
|
|
||||||
# Convert a CMake list to a JSON list and store it in a variable
|
# Convert a CMake list to a JSON list and store it in a variable
|
||||||
function(make_json_list list variable)
|
function(make_json_list list variable)
|
||||||
|
list(LENGTH list length)
|
||||||
|
if(${length})
|
||||||
string(REPLACE ";" "\", \"" result "[ \"${list}\" ]")
|
string(REPLACE ";" "\", \"" result "[ \"${list}\" ]")
|
||||||
|
else()
|
||||||
|
set(result "[]")
|
||||||
|
endif()
|
||||||
set("${variable}" "${result}" PARENT_SCOPE)
|
set("${variable}" "${result}" PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user