summarylogtreecommitdiffstats
path: root/0001-Fix-mingw-w64-build.patch
blob: 932cedcbed2f86a73fbfb73e04b312dabe855625 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
From f1095a1c3cc81a3ab05e92dd9fea23756409ae18 Mon Sep 17 00:00:00 2001
From: Martchus <martchus@gmx.net>
Date: Sat, 10 Aug 2024 17:49:11 +0200
Subject: [PATCH 1/3] Fix mingw-w64 build

This patch is taken from https://raw.githubusercontent.com/msys2/MINGW-packages/master/mingw-w64-libmariadbclient/001-mingw-build.patch.
---
 CMakeLists.txt            |  2 +-
 cmake/install.cmake       |  6 +++---
 libmariadb/CMakeLists.txt | 11 ++++++++++-
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b987bc7f..dbf008d8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -428,7 +428,7 @@ ENDIF()
 INCLUDE(${CC_SOURCE_DIR}/plugins/CMakeLists.txt)
 ADD_SUBDIRECTORY(include)
 ADD_SUBDIRECTORY(libmariadb)
-IF((NOT WIN32) OR CYGWIN)
+IF((NOT MSVC) OR CYGWIN)
   ADD_SUBDIRECTORY(mariadb_config)
 ENDIF()
 
diff --git a/cmake/install.cmake b/cmake/install.cmake
index 90bae8b5..d9797138 100644
--- a/cmake/install.cmake
+++ b/cmake/install.cmake
@@ -62,11 +62,11 @@ ENDIF()
 #
 
 SET(INSTALL_BINDIR_DEFAULT "bin")
-SET(INSTALL_LIBDIR_DEFAULT "lib/mariadb")
+SET(INSTALL_LIBDIR_DEFAULT "lib")
 SET(INSTALL_PCDIR_DEFAULT "lib/pkgconfig")
 SET(INSTALL_INCLUDEDIR_DEFAULT "include/mariadb")
-SET(INSTALL_DOCDIR_DEFAULT "docs")
-SET(INSTALL_MANDIR_DEFAULT "man")
+SET(INSTALL_DOCDIR_DEFAULT "share/docs/mariadb")
+SET(INSTALL_MANDIR_DEFAULT "share/man")
 IF(NOT IS_SUBPROJECT)
   SET(INSTALL_PLUGINDIR_DEFAULT "lib/mariadb/plugin")
 ELSE()
diff --git a/libmariadb/CMakeLists.txt b/libmariadb/CMakeLists.txt
index 43ed67b4..82068487 100644
--- a/libmariadb/CMakeLists.txt
+++ b/libmariadb/CMakeLists.txt
@@ -496,6 +496,13 @@ SET_TARGET_PROPERTIES(libmariadb PROPERTIES VERSION
  ${CPACK_PACKAGE_VERSION_MAJOR}
  SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR})
 
+IF(MINGW)
+  SET_TARGET_PROPERTIES(libmariadb PROPERTIES
+                        OUTPUT_NAME mariadb
+                        RUNTIME_OUTPUT_NAME libmariadb
+                        ARCHIVE_OUTPUT_NAME mariadb)
+ENDIF()
+
 IF(NOT WIN32)
   SET_TARGET_PROPERTIES(mariadbclient PROPERTIES OUTPUT_NAME "${LIBMARIADB_STATIC_NAME}")
 ENDIF()
@@ -506,7 +513,9 @@ INSTALL(TARGETS mariadbclient
 IF(WIN32)
 INSTALL(TARGETS libmariadb
         COMPONENT SharedLibraries
-        DESTINATION ${INSTALL_LIBDIR})
+        RUNTIME DESTINATION ${INSTALL_BINDIR}
+        LIBRARY DESTINATION ${INSTALL_LIBDIR}
+        ARCHIVE DESTINATION ${INSTALL_LIBDIR})
 ELSE()
 # in cmake 3.12+ we can use
 #INSTALL(TARGETS libmariadb LIBRARY DESTINATION ${INSTALL_LIBDIR}
-- 
2.46.0