Any unblananced `[` `]` in a string will inhibit transformation after that point in the list
My guess this is due to some bracket argument logic which incorrectly early terminates.
cmake_minimum_required(VERSION 3.25)
set(input_string "This string has [ which \n stops \n list creation")
string(REPLACE "\n" ";" output_string "${input_string}")
foreach(line IN LISTS output_string)
message("- ${line} -")
endforeach()
set(input_string "This string has [] which doesn't \n stop \n list creation")
string(REPLACE "\n" ";" output_string "${input_string}")
foreach(line IN LISTS output_string)
message("- ${line} -")
endforeach()
Console Output:
cmake -P ./string_literal.cmake
- This string has [ which ; stops ; list creation -
- This string has [] which doesn't -
- stop -
- list creation -