REMOVE_DUPLICATES does not respect embedded ;
We use a CMake script to process CTestTestfile.cmake
files. However, after the _BACKTRACE_TRIPLES
was added in CMake 3.14, the script "obfuscates" the CTestTestfile.cmake
. The root cause is that REMOVE_DUPLICATES
does not respect embedded ;
but mistakes them for list separators.
Below is a small script that demonstrates the issue.
$ cmake --version
cmake version 3.14.5
$ cat > test_remove_duplicated_lines.cmake <<EOF
file(STRINGS myfile.txt mylist)
set(mylist "one;one;two\;two")
message("Original list")
foreach(X IN LISTS mylist)
message(STATUS "${X}")
endforeach()
message("List with REMOVE_DUPLICATES")
list(REMOVE_DUPLICATES mylist)
foreach(X IN LISTS mylist)
message(STATUS "${X}")
endforeach()
EOF
I expected the result of the below script to be:
Original list
-- one
-- one
-- two;two
List with REMOVE_DUPLICATES
-- one
-- two;two
The actual result is:
$ cmake -P test_remove_duplicated_lines.cmake
Original list
-- one
-- one
-- two;two
List with REMOVE_DUPLICATES
-- one
-- two
-- two
The last two lines are wrong?