check_if_cross_compiling(CCWIN "Windows" "")
if(CCWIN)
- # Roughly following https://stackoverflow.com/a/44383330/2375725
- set(patchcmd
- # Avoid %z and %llu format specifiers
- COMMAND find <SOURCE_DIR>/ -type f ! -name "*.orig" -exec
- sed -i.orig "s/%z[diu]/%\\\" PRIu64 \\\"/g" {} +
- COMMAND find <SOURCE_DIR>/ -type f ! -name "*.orig" -exec
- sed -i.orig "s/%ll[du]/%\\\" PRIu64 \\\"/g" {} +
- # Make sure the new macros are available
- COMMAND find <SOURCE_DIR>/ -type f ! -name "*.orig" -exec
- sed -i.orig "s/#include <stdio.h>/#include <stdio.h>\\\\n#include <inttypes.h>/" {} +
- COMMAND find <SOURCE_DIR>/ -type f ! -name "*.orig" -exec
- sed -i.orig "s/#include <cstdio>/#include <cstdio>\\\\n#include <inttypes.h>/" {} +
+ set(patchcmd COMMAND
+ ${CMAKE_SOURCE_DIR}/cmake/deps-utils/Poly-windows-patch.sh <SOURCE_DIR>
)
else()
unset(patchcmd)
--- /dev/null
+#!/bin/sh
+
+# Roughly following https://stackoverflow.com/a/44383330/2375725
+# Avoid %z and %llu format specifiers
+find $1/ -type f ! -name "*.orig" -exec \
+ sed -i.orig "s/%z[diu]/%\\\" PRIu64 \\\"/g" {} +
+find $1/ -type f ! -name "*.orig" -exec \
+ sed -i.orig "s/%ll[du]/%\\\" PRIu64 \\\"/g" {} +
+
+# Make sure the new macros are available
+find $1/ -type f ! -name "*.orig" -exec \
+ sed -i.orig "s/#include <stdio.h>/#include <stdio.h>\\n#include <inttypes.h>/" {} +
+find $1/ -type f ! -name "*.orig" -exec \
+ sed -i.orig "s/#include <cstdio>/#include <cstdio>\\n#include <inttypes.h>/" {} +
\ No newline at end of file