Mercurial > hg > orthanc
annotate OrthancFramework/Resources/CMake/LibIconvConfiguration.cmake @ 4437:d9473bd5ed43
upgrade to year 2021
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 06 Jan 2021 17:27:28 +0100 |
parents | 304842a0d152 |
children | 7053502fbf97 |
rev | line source |
---|---|
4120
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
1 # Orthanc - A Lightweight, RESTful DICOM Store |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
3 # Department, University Hospital of Liege, Belgium |
4437
d9473bd5ed43
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4120
diff
changeset
|
4 # Copyright (C) 2017-2021 Osimis S.A., Belgium |
4120
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
5 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
6 # This program is free software: you can redistribute it and/or |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
7 # modify it under the terms of the GNU Lesser General Public License |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
8 # as published by the Free Software Foundation, either version 3 of |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
9 # the License, or (at your option) any later version. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
10 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
11 # This program is distributed in the hope that it will be useful, but |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
12 # WITHOUT ANY WARRANTY; without even the implied warranty of |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
14 # Lesser General Public License for more details. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
15 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
16 # You should have received a copy of the GNU Lesser General Public |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
17 # License along with this program. If not, see |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
18 # <http://www.gnu.org/licenses/>. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
19 |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
20 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
21 message("Using libiconv") |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
22 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
23 if (STATIC_BUILD OR NOT USE_SYSTEM_LIBICONV) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
24 set(LIBICONV_SOURCES_DIR ${CMAKE_BINARY_DIR}/libiconv-1.15) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
25 set(LIBICONV_URL "http://orthanc.osimis.io/ThirdPartyDownloads/libiconv-1.15.tar.gz") |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
26 set(LIBICONV_MD5 "ace8b5f2db42f7b3b3057585e80d9808") |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
27 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
28 DownloadPackage(${LIBICONV_MD5} ${LIBICONV_URL} "${LIBICONV_SOURCES_DIR}") |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
29 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
30 # Disable the support of libiconv that is shipped by default with |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
31 # the C standard library on Linux. Setting this macro redirects |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
32 # calls from "iconv*()" to "libiconv*()" by defining macros in the |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
33 # C headers of "libiconv-1.15". |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
34 add_definitions(-DLIBICONV_PLUG=1) |
1094
1b905ad6c913
Replace wconv by iconv under Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
36 # https://groups.google.com/d/msg/android-ndk/AS1nkxnk6m4/EQm09hD1tigJ |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
37 add_definitions( |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
38 -DBUILDING_LIBICONV=1 |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
39 -DIN_LIBRARY=1 |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
40 -DLIBDIR="" |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
41 -DICONV_CONST= |
3241
32596919d729
first compilation combining ICU and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3228
diff
changeset
|
42 #-DENABLE_EXTRA=1 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
43 ) |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
44 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
45 configure_file( |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
46 ${LIBICONV_SOURCES_DIR}/srclib/localcharset.h |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
47 ${LIBICONV_SOURCES_DIR}/include |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
48 COPYONLY) |
1094
1b905ad6c913
Replace wconv by iconv under Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
50 set(HAVE_VISIBILITY 0) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
51 set(ICONV_CONST ${ICONV_CONST}) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
52 set(USE_MBSTATE_T 1) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
53 set(BROKEN_WCHAR_H 0) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
54 set(EILSEQ) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
55 set(HAVE_WCHAR_T 1) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
56 configure_file( |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
57 ${LIBICONV_SOURCES_DIR}/include/iconv.h.build.in |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
58 ${LIBICONV_SOURCES_DIR}/include/iconv.h |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
59 ) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
60 unset(HAVE_VISIBILITY) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
61 unset(ICONV_CONST) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
62 unset(USE_MBSTATE_T) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
63 unset(BROKEN_WCHAR_H) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
64 unset(EILSEQ) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
65 unset(HAVE_WCHAR_T) |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
66 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
67 if (NOT EXISTS ${LIBICONV_SOURCES_DIR}/include/config.h) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
68 # Create an empty "config.h" for libiconv |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
69 file(WRITE ${LIBICONV_SOURCES_DIR}/include/config.h "") |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
70 endif() |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
71 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
72 include_directories( |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
73 ${LIBICONV_SOURCES_DIR}/include |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
74 ) |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
75 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
76 set(LIBICONV_SOURCES |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
77 ${LIBICONV_SOURCES_DIR}/lib/iconv.c |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
78 ${LIBICONV_SOURCES_DIR}/lib/relocatable.c |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
79 ${LIBICONV_SOURCES_DIR}/libcharset/lib/localcharset.c |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
80 ${LIBICONV_SOURCES_DIR}/libcharset/lib/relocatable.c |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
81 ) |
1094
1b905ad6c913
Replace wconv by iconv under Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
83 source_group(ThirdParty\\libiconv REGULAR_EXPRESSION ${LIBICONV_SOURCES_DIR}/.*) |
1494 | 84 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
85 if (CMAKE_SYSTEM_NAME STREQUAL "Windows") |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
86 add_definitions(-DHAVE_WORKING_O_NOFOLLOW=0) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
87 else() |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
88 add_definitions(-DHAVE_WORKING_O_NOFOLLOW=1) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
89 endif() |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
90 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
91 else() |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
92 CHECK_INCLUDE_FILE_CXX(iconv.h HAVE_ICONV_H) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
93 if (NOT HAVE_ICONV_H) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
94 message(FATAL_ERROR "Please install the libiconv-dev package") |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
95 endif() |
1094
1b905ad6c913
Replace wconv by iconv under Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
97 # Check whether the support for libiconv is bundled within the |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
98 # standard C library |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
99 CHECK_FUNCTION_EXISTS(iconv_open HAVE_ICONV_LIB) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
100 if (NOT HAVE_ICONV_LIB) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
101 # No builtin support for libiconv, try and find an external library. |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
102 # Open question: Does this make sense on any platform? |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
103 CHECK_LIBRARY_EXISTS(iconv iconv_open "" HAVE_ICONV_LIB_2) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
104 if (NOT HAVE_ICONV_LIB_2) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
105 message(FATAL_ERROR "Please install the libiconv-dev package") |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
106 else() |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
107 link_libraries(iconv) |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
108 endif() |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
109 endif() |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
110 endif() |