Add KMime
[gpg4win.git] / patches / kmime / 0002-Fix-Windows-build.patch
1 #! /bin/sh
2 patch -p1 -f -l $* < $0
3 exit $?
4
5 From d977ebb7d83cdbe01875273f133d5696af628c29 Mon Sep 17 00:00:00 2001
6 From: Andre Heinecke <aheinecke@intevation.de>
7 Date: Mon, 25 Jan 2016 18:05:01 +0100
8 Subject: [PATCH 2/2] Fix Windows build
9
10 gethostname is part of Winsock2 on Windows.
11 ---
12  src/CMakeLists.txt | 5 +++++
13  src/kmime_mdn.cpp  | 6 +++++-
14  2 files changed, 10 insertions(+), 1 deletion(-)
15
16 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
17 index 3a4517b..2b62c6d 100644
18 --- a/src/CMakeLists.txt
19 +++ b/src/CMakeLists.txt
20 @@ -33,12 +33,17 @@ add_library(KF5::Mime ALIAS KF5Mime)
21  target_include_directories(KF5Mime INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF5}/KMime>")
22  target_include_directories(KF5Mime PUBLIC "$<BUILD_INTERFACE:${KMime_SOURCE_DIR}/src;${KMime_BINARY_DIR}/src;${KMime_BINARY_DIR}>")
23
24 +if (WIN32)
25 +    set(_kmime_extra_libs ws2_32)
26 +endif()
27 +
28  target_link_libraries(KF5Mime
29  PUBLIC
30      Qt5::Core
31  PRIVATE
32      KF5::I18n
33      KF5::Codecs
34 +    ${_kmime_extra_libs}
35  )
36
37  set_target_properties(KF5Mime PROPERTIES
38 diff --git a/src/kmime_mdn.cpp b/src/kmime_mdn.cpp
39 index 3061112..c441291 100644
40 --- a/src/kmime_mdn.cpp
41 +++ b/src/kmime_mdn.cpp
42 @@ -41,7 +41,11 @@
43
44  #include <QtCore/QByteArray>
45
46 -#include <unistd.h> // gethostname
47 +#ifdef Q_OS_WIN // gethostname
48 +# include <winsock2.h>
49 +#else
50 +# include <unistd.h>
51 +#endif
52
53  namespace KMime
54  {
55 --
56 2.1.4