1 # Sort a subset of a list according to the ordering in the full list.
3 # Given a list and a subset of that list, this function sorts the subset
4 # according to the order in the full list, and returns that in the given
8 # The list containing the desired order of elements in the sub-list.
11 # A subset of the elements in `full_list`. Those elements will be sorted
12 # according to the order in `full_list`.
15 # A variable to store the resulting sorted sub-list in.
16 function(sort_subset full_list sub_list out_var)
17 set(result "${full_list}")
18 foreach(project IN LISTS full_list)
19 if (NOT project IN_LIST sub_list)
20 list(REMOVE_ITEM result ${project})
24 set(${out_var} "${result}" PARENT_SCOPE)