aboutsummaryrefslogtreecommitdiff
path: root/cmake/modules/PaludisList.cmake
blob: 567ebebb23b2e11074d5aa743854d6de6e6253e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function(list_replace input_list old new)
  set(replaced_list)
  foreach(item ${${input_list}})
    if(${item} STREQUAL ${old})
      list(APPEND replaced_list ${new})
    else()
      list(APPEND replaced_list ${item})
    endif()
  endforeach()
  set("${input_list}" "${replaced_list}" PARENT_SCOPE)
endfunction()

function(list_union lhs rhs result_var_name)
  set(result)
  foreach(item IN LISTS lhs rhs)
    list(FIND result "${item}" index)
    if(${index} EQUAL -1)
      list(APPEND result "${item}")
    endif()
  endforeach()
  set("${result_var_name}" "${result}" PARENT_SCOPE)
endfunction()