mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-03 03:31:41 +03:00
feat(cmakev2/utilities): add __list_difference function
Return the difference between two lists, meaning the elements that are present in the first list but not in the second. Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
@@ -1181,3 +1181,32 @@ function(__list_intersection list1 list2 output_var)
|
|||||||
endforeach()
|
endforeach()
|
||||||
set(${output_var} "${result}" PARENT_SCOPE)
|
set(${output_var} "${result}" PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
#[[
|
||||||
|
__list_difference(<list1> <list2> <output_var>)
|
||||||
|
|
||||||
|
*list1[in]*
|
||||||
|
|
||||||
|
First list.
|
||||||
|
|
||||||
|
*list2[in]*
|
||||||
|
|
||||||
|
Second list.
|
||||||
|
|
||||||
|
*output_var[out]*
|
||||||
|
|
||||||
|
Variable name where the resulting list will be stored.
|
||||||
|
|
||||||
|
Return the difference between the elements of ``list1`` and ``list2``. In
|
||||||
|
other words, the elements that are present in ``list1`` but not in
|
||||||
|
``list2``. The resulting list is stored in the ``output_var`` list.
|
||||||
|
#]]
|
||||||
|
function(__list_difference list1 list2 output_var)
|
||||||
|
set(result "")
|
||||||
|
foreach(item IN LISTS ${list1})
|
||||||
|
if(NOT item IN_LIST ${list2})
|
||||||
|
list(APPEND result "${item}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
set(${output_var} "${result}" PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|||||||
Reference in New Issue
Block a user