summaryrefslogtreecommitdiffstats
path: root/cmake/remove-ordinals.cmake
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 03:10:08 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 03:10:08 +0000
commit5262a872f308b3b584c97d621992fb3877e392b8 (patch)
treeb956c322376141abeafe639bd72cfecdf16954b5 /cmake/remove-ordinals.cmake
parentInitial commit. (diff)
downloadxz-utils-5262a872f308b3b584c97d621992fb3877e392b8.tar.xz
xz-utils-5262a872f308b3b584c97d621992fb3877e392b8.zip
Adding upstream version 5.6.1+really5.4.5.upstream/5.6.1+really5.4.5
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cmake/remove-ordinals.cmake')
-rw-r--r--cmake/remove-ordinals.cmake26
1 files changed, 26 insertions, 0 deletions
diff --git a/cmake/remove-ordinals.cmake b/cmake/remove-ordinals.cmake
new file mode 100644
index 0000000..96419d5
--- /dev/null
+++ b/cmake/remove-ordinals.cmake
@@ -0,0 +1,26 @@
+#############################################################################
+#
+# remove-ordinals.cmake
+#
+# Removes the ordinal numbers from a DEF file that has been created by
+# GNU ld or LLVM lld option --output-def (when creating a Windows DLL).
+# This should be equivalent: sed 's/ \+@ *[0-9]\+//'
+#
+# Usage:
+#
+# cmake -DINPUT_FILE=infile.def.in \
+# -DOUTPUT_FILE=outfile.def \
+# -P remove-ordinals.cmake
+#
+#############################################################################
+#
+# Author: Lasse Collin
+#
+# This file has been put into the public domain.
+# You can do whatever you want with this file.
+#
+#############################################################################
+
+file(READ "${INPUT_FILE}" STR)
+string(REGEX REPLACE " +@ *[0-9]+" "" STR "${STR}")
+file(WRITE "${OUTPUT_FILE}" "${STR}")