`list(INSERT ...)` fails when inserting at the end of a list
Create insert_at_end.cmake
with:
set(my_list item1 item2)
list(INSERT my_list 2 item3)
message("my_list: ${my_list}")
Run with:
$ cmake -P insert_at_end.cmake
CMake Error at insert_at_end.cmake:2 (list):
list index: 2 out of range (-2, 1)
I know that list(APPEND ...)
can be used to work around this but it makes life unnecessaryily complicated when the list position is calculated programmatically.