| 1 |
string(REPLACE " " ";" replacement_pairs ${replacement_pairs}) |
| 2 |
|
| 3 |
file(READ "${input_file}" text) |
| 4 |
|
| 5 |
list(LENGTH replacement_pairs length) |
| 6 |
math(EXPR last_index "${length} - 1") |
| 7 |
|
| 8 |
foreach(regex_index RANGE 0 ${last_index} 2) |
| 9 |
math(EXPR replacement_index "${regex_index} + 1") |
| 10 |
LIST(GET replacement_pairs ${regex_index} regex_expression) |
| 11 |
LIST(GET replacement_pairs ${replacement_index} replacement_expression) |
| 12 |
string(REPLACE |
| 13 |
"${regex_expression}" |
| 14 |
"${replacement_expression}" |
| 15 |
text "${text}") |
| 16 |
endforeach() |
| 17 |
|
| 18 |
file(WRITE ${output_file} "${text}") |