Mercurial > hg > orthanc
annotate Resources/CMake/LibIconvConfiguration.cmake @ 2805:e02af4ca8003
Fix issue #54 (quoting multipart answers)
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 04 Sep 2018 10:10:22 +0200 |
parents | a29ffb73f6fd |
children | 0c2a8d5e0097 |
rev | line source |
---|---|
2367
2aff870c2c58
refactoring of BoostConfiguration.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2366
diff
changeset
|
1 if (NOT ENABLE_LOCALE) |
2aff870c2c58
refactoring of BoostConfiguration.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2366
diff
changeset
|
2 message("Support for locales is disabled") |
1537
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1494
diff
changeset
|
3 |
2367
2aff870c2c58
refactoring of BoostConfiguration.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2366
diff
changeset
|
4 elseif (NOT USE_BOOST_ICONV) |
2aff870c2c58
refactoring of BoostConfiguration.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2366
diff
changeset
|
5 message("Not using libiconv") |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
6 |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
7 else() |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
8 message("Using libiconv") |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
9 |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
10 if (STATIC_BUILD OR NOT USE_SYSTEM_LIBICONV) |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
11 set(LIBICONV_SOURCES_DIR ${CMAKE_BINARY_DIR}/libiconv-1.15) |
2384 | 12 set(LIBICONV_URL "http://www.orthanc-server.com/downloads/third-party/libiconv-1.15.tar.gz") |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
13 set(LIBICONV_MD5 "ace8b5f2db42f7b3b3057585e80d9808") |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
14 |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
15 DownloadPackage(${LIBICONV_MD5} ${LIBICONV_URL} "${LIBICONV_SOURCES_DIR}") |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
16 |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
17 # Disable the support of libiconv that is shipped by default with |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
18 # the C standard library on Linux. Setting this macro redirects |
2367
2aff870c2c58
refactoring of BoostConfiguration.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2366
diff
changeset
|
19 # calls from "iconv*()" to "libiconv*()" by defining macros in the |
2aff870c2c58
refactoring of BoostConfiguration.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2366
diff
changeset
|
20 # C headers of "libiconv-1.15". |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
21 add_definitions(-DLIBICONV_PLUG=1) |
1094
1b905ad6c913
Replace wconv by iconv under Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
23 # https://groups.google.com/d/msg/android-ndk/AS1nkxnk6m4/EQm09hD1tigJ |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
24 add_definitions( |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
25 -DBUILDING_LIBICONV=1 |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
26 -DIN_LIBRARY=1 |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
27 -DLIBDIR="" |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
28 -DICONV_CONST= |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
29 ) |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
30 |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
31 configure_file( |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
32 ${LIBICONV_SOURCES_DIR}/srclib/localcharset.h |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
33 ${LIBICONV_SOURCES_DIR}/include |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
34 COPYONLY) |
1094
1b905ad6c913
Replace wconv by iconv under Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
36 set(HAVE_VISIBILITY 0) |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
37 set(ICONV_CONST ${ICONV_CONST}) |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
38 set(USE_MBSTATE_T 1) |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
39 set(BROKEN_WCHAR_H 0) |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
40 set(EILSEQ) |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
41 set(HAVE_WCHAR_T 1) |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
42 configure_file( |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
43 ${LIBICONV_SOURCES_DIR}/include/iconv.h.build.in |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
44 ${LIBICONV_SOURCES_DIR}/include/iconv.h |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
45 ) |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
46 unset(HAVE_VISIBILITY) |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
47 unset(ICONV_CONST) |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
48 unset(USE_MBSTATE_T) |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
49 unset(BROKEN_WCHAR_H) |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
50 unset(EILSEQ) |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
51 unset(HAVE_WCHAR_T) |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
52 |
2524
a29ffb73f6fd
optimization in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2384
diff
changeset
|
53 if (NOT EXISTS ${LIBICONV_SOURCES_DIR}/include/config.h) |
a29ffb73f6fd
optimization in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2384
diff
changeset
|
54 # Create an empty "config.h" for libiconv |
a29ffb73f6fd
optimization in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2384
diff
changeset
|
55 file(WRITE ${LIBICONV_SOURCES_DIR}/include/config.h "") |
a29ffb73f6fd
optimization in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2384
diff
changeset
|
56 endif() |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
57 |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
58 include_directories( |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
59 ${LIBICONV_SOURCES_DIR}/include |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
60 ) |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
61 |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
62 set(LIBICONV_SOURCES |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
63 ${LIBICONV_SOURCES_DIR}/lib/iconv.c |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
64 ${LIBICONV_SOURCES_DIR}/lib/relocatable.c |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
65 ${LIBICONV_SOURCES_DIR}/libcharset/lib/localcharset.c |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
66 ${LIBICONV_SOURCES_DIR}/libcharset/lib/relocatable.c |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
67 ) |
1094
1b905ad6c913
Replace wconv by iconv under Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
69 source_group(ThirdParty\\libiconv REGULAR_EXPRESSION ${LIBICONV_SOURCES_DIR}/.*) |
1494 | 70 |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
71 if (CMAKE_SYSTEM_NAME STREQUAL "Windows") |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
72 add_definitions(-DHAVE_WORKING_O_NOFOLLOW=0) |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
73 else() |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
74 add_definitions(-DHAVE_WORKING_O_NOFOLLOW=1) |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
75 endif() |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
76 |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
77 else() |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
78 CHECK_INCLUDE_FILE_CXX(iconv.h HAVE_ICONV_H) |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
79 if (NOT HAVE_ICONV_H) |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
80 message(FATAL_ERROR "Please install the libiconv-dev package") |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
81 endif() |
1094
1b905ad6c913
Replace wconv by iconv under Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
83 # Check whether the support for libiconv is bundled within the |
2371 | 84 # standard C library |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
85 CHECK_FUNCTION_EXISTS(iconv_open HAVE_ICONV_LIB) |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
86 if (NOT HAVE_ICONV_LIB) |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
87 # No builtin support for libiconv, try and find an external library. |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
88 # Open question: Does this make sense on any platform? |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
89 CHECK_LIBRARY_EXISTS(iconv iconv_open "" HAVE_ICONV_LIB_2) |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
90 if (NOT HAVE_ICONV_LIB_2) |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
91 message(FATAL_ERROR "Please install the libiconv-dev package") |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
92 else() |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
93 link_libraries(iconv) |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
94 endif() |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
95 endif() |
2113
0108ac01fc8e
added source_group directives for MSVC
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
96 |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
97 endif() |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
98 endif() |