summaryrefslogtreecommitdiffstats
path: root/cmake/sed.cmake
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--cmake/sed.cmake12
1 files changed, 12 insertions, 0 deletions
diff --git a/cmake/sed.cmake b/cmake/sed.cmake
new file mode 100644
index 0000000..feb0f1e
--- /dev/null
+++ b/cmake/sed.cmake
@@ -0,0 +1,12 @@
+set(SED_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/sed.script.cmake"
+ CACHE INTERNAL "path to sed script")
+
+function(sed input_file output_file)
+ add_custom_command(OUTPUT "${output_file}"
+ COMMAND ${CMAKE_COMMAND}
+ -Dinput_file="${input_file}"
+ -Doutput_file="${output_file}"
+ -Dreplacement_pairs="${ARGN}"
+ -P ${SED_SCRIPT}
+ DEPENDS "${input_file}")
+endfunction()