File: Txt2C.cmake

package info (click to toggle)
kicad 9.0.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 770,320 kB
  • sloc: cpp: 961,692; ansic: 121,001; xml: 66,428; python: 18,387; sh: 1,010; awk: 301; asm: 292; makefile: 227; javascript: 167; perl: 10
file content (13 lines) | stat: -rw-r--r-- 509 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13

# CMake script file to process a text file for use as an immediate string value in C/C++.
# It escapes double-quotes and then wraps every line in (unescaped) double-quotes.

set( lines "" )
file( STRINGS ${inputFile} lines )

file( WRITE ${outputFile} "// Do not edit this file, it is autogenerated by CMake from a .txt file\n" )

foreach( line IN LISTS lines )
    STRING(REGEX REPLACE "\"" "\\\\\"" linem "${line}" )
    file( APPEND ${outputFile} "\"" "${linem}" "\\n\"\n" )
endforeach( line "${lines}" )