Mercurial > hg > orthanc
annotate Resources/CMake/LibIcuConfiguration.cmake @ 3230:4b042ec734c1
dynamic linking against libicu
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 14 Feb 2019 20:22:33 +0100 |
parents | 4b9cfd92d1ae |
children | fc5bc0fe863c |
rev | line source |
---|---|
3228 | 1 message("Using libicu") |
2 | |
3 if (STATIC_BUILD OR NOT USE_SYSTEM_LIBICU) | |
4 # set(LIBICU_SOURCES_DIR ${CMAKE_BINARY_DIR}/libicu-1.15) | |
5 # set(LIBICU_URL "http://orthanc.osimis.io/ThirdPartyDownloads/libicu-1.15.tar.gz") | |
6 # set(LIBICU_MD5 "ace8b5f2db42f7b3b3057585e80d9808") | |
7 | |
8 # DownloadPackage(${LIBICU_MD5} ${LIBICU_URL} "${LIBICU_SOURCES_DIR}") | |
9 | |
10 # # Disable the support of libicu that is shipped by default with | |
11 # # the C standard library on Linux. Setting this macro redirects | |
12 # # calls from "icu*()" to "libicu*()" by defining macros in the | |
13 # # C headers of "libicu-1.15". | |
14 # add_definitions(-DLIBICU_PLUG=1) | |
15 | |
16 # # https://groups.google.com/d/msg/android-ndk/AS1nkxnk6m4/EQm09hD1tigJ | |
17 # add_definitions( | |
18 # -DBUILDING_LIBICU=1 | |
19 # -DIN_LIBRARY=1 | |
20 # -DLIBDIR="" | |
21 # -DICU_CONST= | |
22 # ) | |
23 | |
24 # configure_file( | |
25 # ${LIBICU_SOURCES_DIR}/srclib/localcharset.h | |
26 # ${LIBICU_SOURCES_DIR}/include | |
27 # COPYONLY) | |
28 | |
29 # set(HAVE_VISIBILITY 0) | |
30 # set(ICU_CONST ${ICU_CONST}) | |
31 # set(USE_MBSTATE_T 1) | |
32 # set(BROKEN_WCHAR_H 0) | |
33 # set(EILSEQ) | |
34 # set(HAVE_WCHAR_T 1) | |
35 # configure_file( | |
36 # ${LIBICU_SOURCES_DIR}/include/icu.h.build.in | |
37 # ${LIBICU_SOURCES_DIR}/include/icu.h | |
38 # ) | |
39 # unset(HAVE_VISIBILITY) | |
40 # unset(ICU_CONST) | |
41 # unset(USE_MBSTATE_T) | |
42 # unset(BROKEN_WCHAR_H) | |
43 # unset(EILSEQ) | |
44 # unset(HAVE_WCHAR_T) | |
45 | |
46 # if (NOT EXISTS ${LIBICU_SOURCES_DIR}/include/config.h) | |
47 # # Create an empty "config.h" for libicu | |
48 # file(WRITE ${LIBICU_SOURCES_DIR}/include/config.h "") | |
49 # endif() | |
50 | |
51 # include_directories( | |
52 # ${LIBICU_SOURCES_DIR}/include | |
53 # ) | |
54 | |
55 # set(LIBICU_SOURCES | |
56 # ${LIBICU_SOURCES_DIR}/lib/icu.c | |
57 # ${LIBICU_SOURCES_DIR}/lib/relocatable.c | |
58 # ${LIBICU_SOURCES_DIR}/libcharset/lib/localcharset.c | |
59 # ${LIBICU_SOURCES_DIR}/libcharset/lib/relocatable.c | |
60 # ) | |
61 | |
62 # source_group(ThirdParty\\libicu REGULAR_EXPRESSION ${LIBICU_SOURCES_DIR}/.*) | |
63 | |
64 # if (CMAKE_SYSTEM_NAME STREQUAL "Windows") | |
65 # add_definitions(-DHAVE_WORKING_O_NOFOLLOW=0) | |
66 # else() | |
67 # add_definitions(-DHAVE_WORKING_O_NOFOLLOW=1) | |
68 # endif() | |
69 | |
70 else() | |
71 CHECK_INCLUDE_FILE_CXX(unicode/uvernum.h HAVE_ICU_H) | |
72 if (NOT HAVE_ICU_H) | |
73 message(FATAL_ERROR "Please install the libicu-dev package") | |
74 endif() | |
75 | |
3230
4b042ec734c1
dynamic linking against libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3228
diff
changeset
|
76 find_library(LIBICU_PATH_1 NAMES icuuc) |
4b042ec734c1
dynamic linking against libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3228
diff
changeset
|
77 find_library(LIBICU_PATH_2 NAMES icui18n) |
4b042ec734c1
dynamic linking against libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3228
diff
changeset
|
78 |
4b042ec734c1
dynamic linking against libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3228
diff
changeset
|
79 if (NOT LIBICU_PATH_1 OR |
4b042ec734c1
dynamic linking against libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3228
diff
changeset
|
80 NOT LIBICU_PATH_2) |
4b042ec734c1
dynamic linking against libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3228
diff
changeset
|
81 message(FATAL_ERROR "Please install the libicu-dev package") |
3228 | 82 else() |
3230
4b042ec734c1
dynamic linking against libicu
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3228
diff
changeset
|
83 link_libraries(icuuc icui18n) |
3228 | 84 endif() |
85 endif() |