Mercurial > hg > orthanc
annotate OrthancFramework/Resources/CMake/LibIconvConfiguration.cmake @ 4904:f2e78f7164d6
reintroduction of OpenSslConfigurationStatic-1.1.1.cmake for orthanc-gcp
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 21 Feb 2022 09:34:36 +0100 |
parents | 43e613a7756b |
children | 0ea402b4d901 |
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 |
4870
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
4 # Copyright (C) 2017-2022 Osimis S.A., Belgium |
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
5 # Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
4120
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
6 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
7 # 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
|
8 # 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
|
9 # 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
|
10 # the License, or (at your option) any later version. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
11 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
12 # 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
|
13 # WITHOUT ANY WARRANTY; without even the implied warranty of |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
14 # 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
|
15 # Lesser General Public License for more details. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
16 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
17 # 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
|
18 # License along with this program. If not, see |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
19 # <http://www.gnu.org/licenses/>. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
20 |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
21 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
22 message("Using libiconv") |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
23 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
24 if (STATIC_BUILD OR NOT USE_SYSTEM_LIBICONV) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
25 set(LIBICONV_SOURCES_DIR ${CMAKE_BINARY_DIR}/libiconv-1.15) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
26 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
|
27 set(LIBICONV_MD5 "ace8b5f2db42f7b3b3057585e80d9808") |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
28 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
29 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
|
30 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
31 # 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
|
32 # the C standard library on Linux. Setting this macro redirects |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
33 # calls from "iconv*()" to "libiconv*()" by defining macros in the |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
34 # C headers of "libiconv-1.15". |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
35 add_definitions(-DLIBICONV_PLUG=1) |
1094
1b905ad6c913
Replace wconv by iconv under Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
37 # https://groups.google.com/d/msg/android-ndk/AS1nkxnk6m4/EQm09hD1tigJ |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
38 add_definitions( |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
39 -DBUILDING_LIBICONV=1 |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
40 -DIN_LIBRARY=1 |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
41 -DLIBDIR="" |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
42 -DICONV_CONST= |
3241
32596919d729
first compilation combining ICU and LSB
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3228
diff
changeset
|
43 #-DENABLE_EXTRA=1 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
44 ) |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
45 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
46 configure_file( |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
47 ${LIBICONV_SOURCES_DIR}/srclib/localcharset.h |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
48 ${LIBICONV_SOURCES_DIR}/include |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
49 COPYONLY) |
1094
1b905ad6c913
Replace wconv by iconv under Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
51 set(HAVE_VISIBILITY 0) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
52 set(ICONV_CONST ${ICONV_CONST}) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
53 set(USE_MBSTATE_T 1) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
54 set(BROKEN_WCHAR_H 0) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
55 set(EILSEQ) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
56 set(HAVE_WCHAR_T 1) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
57 configure_file( |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
58 ${LIBICONV_SOURCES_DIR}/include/iconv.h.build.in |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
59 ${LIBICONV_SOURCES_DIR}/include/iconv.h |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
60 ) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
61 unset(HAVE_VISIBILITY) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
62 unset(ICONV_CONST) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
63 unset(USE_MBSTATE_T) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
64 unset(BROKEN_WCHAR_H) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
65 unset(EILSEQ) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
66 unset(HAVE_WCHAR_T) |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
67 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
68 if (NOT EXISTS ${LIBICONV_SOURCES_DIR}/include/config.h) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
69 # Create an empty "config.h" for libiconv |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
70 file(WRITE ${LIBICONV_SOURCES_DIR}/include/config.h "") |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
71 endif() |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
72 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
73 include_directories( |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
74 ${LIBICONV_SOURCES_DIR}/include |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
75 ) |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
76 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
77 set(LIBICONV_SOURCES |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
78 ${LIBICONV_SOURCES_DIR}/lib/iconv.c |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
79 ${LIBICONV_SOURCES_DIR}/lib/relocatable.c |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
80 ${LIBICONV_SOURCES_DIR}/libcharset/lib/localcharset.c |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
81 ${LIBICONV_SOURCES_DIR}/libcharset/lib/relocatable.c |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
82 ) |
1094
1b905ad6c913
Replace wconv by iconv under Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
84 source_group(ThirdParty\\libiconv REGULAR_EXPRESSION ${LIBICONV_SOURCES_DIR}/.*) |
1494 | 85 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
86 if (CMAKE_SYSTEM_NAME STREQUAL "Windows") |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
87 add_definitions(-DHAVE_WORKING_O_NOFOLLOW=0) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
88 else() |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
89 add_definitions(-DHAVE_WORKING_O_NOFOLLOW=1) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
90 endif() |
2366
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
91 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
92 else() |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
93 CHECK_INCLUDE_FILE_CXX(iconv.h HAVE_ICONV_H) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
94 if (NOT HAVE_ICONV_H) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
95 message(FATAL_ERROR "Please install the libiconv-dev package") |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
96 endif() |
1094
1b905ad6c913
Replace wconv by iconv under Windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 |
3228
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
98 # Check whether the support for libiconv is bundled within the |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
99 # standard C library |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
100 CHECK_FUNCTION_EXISTS(iconv_open HAVE_ICONV_LIB) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
101 if (NOT HAVE_ICONV_LIB) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
102 # 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
|
103 # Open question: Does this make sense on any platform? |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
104 CHECK_LIBRARY_EXISTS(iconv iconv_open "" HAVE_ICONV_LIB_2) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
105 if (NOT HAVE_ICONV_LIB_2) |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
106 message(FATAL_ERROR "Please install the libiconv-dev package") |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
107 else() |
4b9cfd92d1ae
preparing for libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
108 link_libraries(iconv) |
2366
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() |
26f3a346226f
more consistent handling of libiconv in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2326
diff
changeset
|
111 endif() |