Exheredludis/cmake/modules/PaludisList.cmake
2016-11-30 08:25:19 -08:00

25 lines
605 B
CMake

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()