You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
1.2 KiB

  1. # CMake script file to process a text file by wrapping every line in double quotes.
  2. # Input file must not abuse quotes, staying with single quotes is probably best.
  3. # note also empty lines cannot be stripped: they have a meaning (separator) in markdown
  4. # so we use file( READ ... ) to read the full file content, including empty lines
  5. file( READ ${inputFile} buffer )
  6. file( WRITE ${outputFile} "// Do not edit this file, it is autogenerated by CMake from an .md file\n" )
  7. #Remark: strings can contain semicolon. a semicolon is a separation in cmake.
  8. #so, to avoid stripping semicolon in variables we have to quote them
  9. # Replace each "\" char by "\\". the \ is found in .md files
  10. # to prepend some chars that are usually control chars
  11. STRING( REPLACE "\\" "\\\\" linea "${buffer}" )
  12. # Replace each " char by \"
  13. STRING( REPLACE "\"" "\\\"" linem "${linea}" )
  14. # Replace each EOL char by "\n" + " + EOL
  15. STRING( REPLACE "\n" "\\n\"\n\"" buff_m "${linem}" )
  16. # create the full string compatible "C":
  17. # _HKI( "<md string>"\n
  18. # to make it translatable. We use here the marker _HKI because
  19. # the translation will be explicitely called in Kicad code
  20. # Write the buffer between quotes
  21. file( APPEND ${outputFile} "_HKI( \"" "${buff_m}" "\" );\n" )