The file() command
This command provides all kinds of operations related to files: reading, transferring, locking, and archiving. It also provides modes to inspect the filesystem and operations on strings representing paths.
Full details can be found in the online documentation:
https://cmake.org/cmake/help/latest/command/file.html
Reading
The following modes are available:
file(READ <filename> <out> [OFFSET <o>] [LIMIT <max>] [HEX])
reads the file from<filename>
to the<out>
variable. The read optionally starts at offset<o>
and follows the optional limit of<max>
bytes. TheHEX flag
specifies that output should be converted to hexadecimal representation.file(STRINGS <filename> <out>)
reads strings from the file at<filename>
to the<out> variable
.file(<algorithm> <filename> <out>)
computes the<algorithm>
hash from the file at<filename>
and stores...