aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2023-09-27 22:46:20 +0300
committerLasse Collin <lasse.collin@tukaani.org>2023-10-26 21:46:06 +0300
commit80e0750e3996c1c659e972ce9cf789ca2e99f702 (patch)
tree37e3f9b852da2265077eca43d422281c32212952 /cmake
parentCMake: Change one CMAKE_CURRENT_SOURCE_DIR to CMAKE_CURRENT_LIST_DIR. (diff)
downloadxz-80e0750e3996c1c659e972ce9cf789ca2e99f702.tar.xz
CMake: Create liblzma.def when building liblzma.dll with MinGW-w64.
Diffstat (limited to '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 00000000..96419d52
--- /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}")