Not paired `]` or `[` characters breaks "file(STRINGS"
function(test_file_content file_path)
file(STRINGS "${file_path}" file_content)
foreach (line IN LISTS file_content)
message("line=${line}")
endforeach()
endfunction()
test_file_content("./test_file_content_lines.txt")
test_file_content_lines.txt
1
2
3]
4
5
cmake -P ./test_file_content.cmake
Output:
line=1
line=2
line=3];4;5
Which one character in a pair and its order is not matter.
Tested in: cmake-3.14.0-win64-x64.msi
, cmake-3.14.1-win64-x64.msi