[CMake] reading in a file and splitting by line
cmake.org › pipermail › cmakeMay 23, 2007 · This "works" with just cmake: FILE(READ "${file}" contents) # Convert file contents into a CMake list (where each element in the list # is one line of the file) # STRING(REGEX REPLACE ";" "\\\\;" contents "${contents}") STRING(REGEX REPLACE " " ";" contents "${contents}") The reason I say "works" (in quotes) is that there are two caveats wherein it does not work: (1) It puts each line of the ...
file — CMake 3.23.0-rc3 Documentation
cmake.org › cmake › helpNew in version 3.2: Added the UTF-16LE, UTF-16BE, UTF-32LE, UTF-32BE encodings. For example, the code. file (STRINGS myfile.txt myfile) stores a list in the variable myfile in which each item is a line from the input file. file (<HASH> <filename> <variable>) Compute a cryptographic hash of the content of <filename> and store it in a <variable>.