My code:
function(my_function)
cmake_parse_arguments(MY_FUNCTION "" "LIST1;LIST2" "" ${ARGN})
message("List 1: ${MY_FUNCTION_LIST1}")
message("List 2: ${MY_FUNCTION_LIST2}")
# Alternatively, you can access the lists directly without parsing
foreach(item IN LISTS MY_FUNCTION_LIST1)
message("Item in List 1: ${item}")
endforeach()
foreach(item IN LISTS MY_FUNCTION_LIST2)
message("Item in List 2: ${item}")
endforeach()
endfunction()
set(my_list1 "item1;item2;item3")
set(my_list2 "itemA;itemB;itemC")
my_function(LIST1 "${my_list1}" LIST2 "${my_list2}")
I hope pass full my_list1 and full my_list2 to my_function, but message out
List 1: item1
List 2: itemA
Item in List 1: item1
Item in List 2: itemA
it only get list first item, how to pass full list to function