File: sed.script.cmake

package info (click to toggle)
frozen 1.2.0-2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,244 kB
  • sloc: cpp: 18,992; ansic: 788; makefile: 77
file content (18 lines) | stat: -rw-r--r-- 568 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
string(REPLACE " " ";" replacement_pairs ${replacement_pairs})

file(READ "${input_file}" text)

list(LENGTH replacement_pairs length)
math(EXPR last_index "${length} - 1")

foreach(regex_index RANGE 0 ${last_index} 2)
  math(EXPR replacement_index "${regex_index} + 1")
  LIST(GET replacement_pairs ${regex_index} regex_expression)
  LIST(GET replacement_pairs ${replacement_index} replacement_expression)
  string(REPLACE
         "${regex_expression}"
         "${replacement_expression}"
         text "${text}")
endforeach()

file(WRITE ${output_file} "${text}")