blob: 7e74a7a1b88dcb5f7afc3fd47bbb368c0f11bd16 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
# Read the input file into 'indata', converting each byte to a pair of hex
# characters
file(READ "${INPUT_FILE}" indata HEX)
# For each pair of characters, indent them and prepend the 0x prefix, and
# append a comma separateor.
# TODO: Prettify this. Should group a number of bytes per line instead of one
# per line.
string(REGEX REPLACE "(..)" " 0x\\1,\n" output "${indata}")
# Write the list of hex chars to the output file
file(WRITE "${OUTPUT_FILE}" "${output}")
|