From 408c608fc7bf1557ee987dd7fbe662fabed21a53 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 07:39:03 +0200 Subject: Adding upstream version 1.1.1. Signed-off-by: Daniel Baumann --- cmake/sed.script.cmake | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 cmake/sed.script.cmake (limited to 'cmake/sed.script.cmake') diff --git a/cmake/sed.script.cmake b/cmake/sed.script.cmake new file mode 100644 index 0000000..a596736 --- /dev/null +++ b/cmake/sed.script.cmake @@ -0,0 +1,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}") -- cgit v1.2.3