summarylogtreecommitdiffstats
path: root/0002-Fix-building-for-mingw-w64-target.patch
blob: ae680139c5eff08c2f0104dcba11f8a3bc1f2f99 (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
From ea00c0d8c5a78a86724c2da2c86cc204f745009c Mon Sep 17 00:00:00 2001
From: Martchus <martchus@gmx.net>
Date: Tue, 14 Jun 2022 23:13:06 +0200
Subject: [PATCH 2/2] Fix building for mingw-w64 target

---
 CMakeLists.txt               | 2 ++
 src/libjasper/CMakeLists.txt | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index eaaef9a..1ed6723 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -789,10 +789,12 @@ message("JAS_INCLUDE_HEIC_CODEC: ${JAS_INCLUDE_HEIC_CODEC}")
 # Check for the Math library.
 ################################################################################
 
+if(NOT WIN32)
 find_library(MATH_LIBRARY m)
 if(NOT MATH_LIBRARY)
 	set(MATH_LIBRARY "")
 endif()
+endif()
 
 ################################################################################
 # Perform shared library setup.
diff --git a/src/libjasper/CMakeLists.txt b/src/libjasper/CMakeLists.txt
index c0b19b3..9fab05f 100644
--- a/src/libjasper/CMakeLists.txt
+++ b/src/libjasper/CMakeLists.txt
@@ -182,6 +182,14 @@ target_include_directories(libjasper BEFORE PRIVATE
 set_target_properties(libjasper PROPERTIES
   OUTPUT_NAME jasper LINKER_LANGUAGE C)
 
+if (MINGW)
+    set_target_properties(libjasper
+                          PROPERTIES
+                          OUTPUT_NAME jasper
+                          RUNTIME_OUTPUT_NAME jasper-${JAS_SO_VERSION}
+                          ARCHIVE_OUTPUT_NAME jasper)
+endif()
+
 if(MSVC)
 	target_compile_definitions(libjasper PRIVATE _CRT_SECURE_NO_WARNINGS)
 	target_compile_definitions(libjasper PRIVATE _CRT_SECURE_NO_DEPRECATE)
-- 
2.43.0