Skip to content

Commit 9b96078

Browse files
committed
cmake: split embedded source lines just in case if an editor or debugger opens it
1 parent 8b5e592 commit 9b96078

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

cmake/EmbedText.cmake

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,17 @@ else()
1515
string(REGEX REPLACE "(..)" "0x\\1," contents ${contents})
1616
endif()
1717

18-
file(WRITE ${OUTPUT_FILE} "const unsigned char ${VARIABLE_NAME}[] = {${contents}};\n")
18+
19+
string(REGEX REPLACE
20+
"(0x..,0x..,0x..,0x..,0x..,0x..,0x..,0x..,0x..,0x..,0x..,0x..,0x..,0x..,0x..,)" "\\1\n"
21+
contents "${contents}"
22+
)
23+
24+
string(REGEX REPLACE ",$" ",\n" contents "${contents}")
25+
26+
file(WRITE ${OUTPUT_FILE}
27+
"const unsigned char ${VARIABLE_NAME}[] =\n"
28+
"{\n"
29+
"${contents}"
30+
"};\n"
31+
)

0 commit comments

Comments
 (0)