vcpkg/ports/libkml/fix-mingw.patch
Billy O'Neal e0a9559a9b
[zlib, minizip] Update to 1.2.13, and embed the ZLIB_DLL setting. (#27226)
* Don't use external ZLIB_DLL

* Update versions

* [minizip] Bump to zlib version

* Update versions

* [libkml] Fix mingw build

* [libkml] Modernize

* [libkml] Fix minizip dependency

* [libkml] No DLL

* Update versions

* [libkml] Update mingw patch

* Update versions

* Update versions

* [zlib] Update to 1.2.13

This picks up the official fix for CVE-2022-37434.

* Cherry pick installing the correct license from https://github.com/microsoft/vcpkg/pull/27242/

* Update version database.

* More version database.

* Also update minizip.

* Also guard ZLIB_DLL properties for BUILD_SHARED_LIBS.

* Version database.

* Fix minizip usage.

Co-authored-by: Kai Pastor <dg0yt@darc.de>
2022-10-25 10:24:48 -07:00

42 lines
1.3 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 028f50a..bb63ffb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,6 +26,9 @@ set(LIBKML_DATA_DIR ${CMAKE_SOURCE_DIR}/testdata CACHE "Directory containing te
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter -pedantic -fno-rtti")
set(TEST_FLAGS "-Wall -Wextra -Wno-unused-parameter -fno-rtti -DGTEST_HAS_RTTI=0")
+if(WIN32)
+ add_definitions(-DUNICODE -D_UNICODE)
+endif()
else()
if(MSVC)
diff --git a/src/kml/base/file_win32.cc b/src/kml/base/file_win32.cc
index 28ccb36..6ba79cd 100644
--- a/src/kml/base/file_win32.cc
+++ b/src/kml/base/file_win32.cc
@@ -34,7 +34,9 @@
#include "kml/base/file.h"
#include <windows.h>
#include <tchar.h>
+#ifndef __MINGW32__
#include <xstring>
+#endif
#include <algorithm>
namespace kmlbase {
diff --git a/src/kml/base/string_util.cc b/src/kml/base/string_util.cc
index b3a9654..842f1cd 100644
--- a/src/kml/base/string_util.cc
+++ b/src/kml/base/string_util.cc
@@ -113,7 +113,7 @@ bool StringEndsWith(const string& str, const string& end) {
}
bool StringCaseEqual(const string& a, const string& b) {
-#ifdef WIN32
+#if defined(WIN32) && !defined(__MINGW32__)
# define strncasecmp(s1, s2, n) _strnicmp (s1, s2, n)
#endif
return a.size() == b.size() && strncasecmp(a.data(), b.data(), a.size()) == 0;