blob: 22cce46b517c22b224db25b3292ca67427ba1a15 (
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
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 90bed54..4b025ae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -453,7 +453,29 @@ if(WIN32)
endif()
set(MZ_LIBBSD OFF)
- set(MZ_ICONV OFF)
+
+ # Iconv is only necessary when it is not already built-in
+ # FindIconv requires cmake 3.11 or higher
+ if (MZ_ICONV)
+ find_package(Iconv QUIET)
+ endif()
+
+ if(Iconv_FOUND)
+ message(STATUS "Using Iconv")
+
+ list(APPEND MINIZIP_DEF -DHAVE_ICONV)
+ list(APPEND MINIZIP_INC ${Iconv_INCLUDE_DIRS})
+ list(APPEND MINIZIP_DEP_PKG Iconv)
+ if(NOT Iconv_IS_BUILT_IN)
+ list(APPEND MINIZIP_LIB ${Iconv_LIBRARIES})
+ list(APPEND MINIZIP_LBD ${Iconv_LIBRARY_DIRS})
+ set(PC_PRIVATE_LIBS "${PC_PRIVATE_LIBS} -liconv")
+ endif()
+ else()
+ message(STATUS "Character encoding support requires iconv")
+
+ set(MZ_ICONV OFF)
+ endif()
else()
list(APPEND STDLIB_DEF -D_POSIX_C_SOURCE=200809L)
list(APPEND MINIZIP_SRC mz_os_posix.c mz_strm_os_posix.c)
|