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
The categories for available file() modes are reading, writing, filesystem, path conversion, transfer, locking, and archiving.
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 flagspecifies that output should be converted to hexadecimal representation.file(STRINGS <filename> <out>)reads strings from the file at<filename>to the<out>variable...