list(INSERT): Empty elements discarded immediately in CMake v3.27
CMake v3.27 broke list handling of empty elements. It discards them similar to CMP0007=old, but immediately. The expected behavior is CMP0007=new, which does not seem to exist anymore.
Use cmake -P
with this script to reproduce:
function(f)
cmake_policy(SET CMP0007 ${ARGN})
set(my_list "0;1;2;3;4")
list(INSERT my_list 1 "")
message(STATUS "${my_list}")
list(INSERT my_list 4 ";")
message(STATUS "${my_list}")
list(INSERT my_list 0 "x")
message(STATUS "${my_list}")
endfunction()
f(NEW)
#[[ v3.26.5 prints
-- 0;;1;2;3;4
-- 0;;1;2;;;3;4
-- x;0;;1;2;;;3;4
]]
#[[ v3.27.0 - v3.27.3 prints
-- 0;1;2;3;4
-- 0;1;2;3;4
-- x;0;1;2;3;4
]]
f(OLD)
#[[ v3.26.5 prints
-- 0;;1;2;3;4
-- 0;1;2;3;;;4
-- x;0;1;2;3;4
]]
#[[ v3.27.0 - v3.27.3 prints
-- 0;1;2;3;4
-- 0;1;2;3;4
-- x;0;1;2;3;4
]]