file READ/WRITE combination drops semicolons from content
Reading a file with semicolon content and then writing this variable to a new file will drop the semicolons.
CMakeLists.txt
cmake_minimum_required(VERSION 3.5)
project(foo)
file(READ test.in FILE_CONTENT)
message("[test.in] File content: \n${FILE_CONTENT}")
file(WRITE test.out ${FILE_CONTENT})
file(READ test.out FILE_CONTENT2)
message("[test.out] File content: \n${FILE_CONTENT2}")
test.in
if (";${_languages};" MATCHES ";CXX;")
Executing this gives the following content in test.out
, with data being lost
test.out
if ("${_languages}" MATCHES "CXX")
Update
NOTE: This is not the same as https://cmake.org/pipermail/cmake/2006-January/008043.html Reading the file gives correct data, see updated example which gives the following output
[test.in] File content:
if (";${_languages};" MATCHES ";CXX;")
[test.out] File content:
if ("${_languages}" MATCHES "CXX")