Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mRemoteNG/PuTTYNG.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/winegcc')
-rwxr-xr-xcmake/winegcc29
1 files changed, 29 insertions, 0 deletions
diff --git a/cmake/winegcc b/cmake/winegcc
new file mode 100755
index 00000000..fb298ad1
--- /dev/null
+++ b/cmake/winegcc
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# Wrapper for winegcc that allows it to be used in a build generated
+# from PuTTY's CMakeLists.txt, by bodging around the command-line
+# options that CMake gets wrong.
+
+init=true
+for arg in init "$@"; do
+ if $init; then
+ set --
+ init=false
+ continue
+ fi
+
+ case "$arg" in
+ # The Windows build definition for PuTTY specifies all the
+ # system API libraries by names like kernel32.lib. When CMake
+ # reads that file and thinks it's compiling for Linux, it will
+ # generate link options such as -lkernel32.lib. But in fact
+ # winegcc expects -lkernel32, so we need to strip the ".lib"
+ # suffix.
+ -l*.lib) set -- "$@" "${arg%.lib}";;
+
+ # Anything else, we leave unchanged.
+ *) set -- "$@" "$arg";;
+ esac
+done
+
+exec winegcc "$@"