Mercurial > hg > orthanc
annotate Resources/CMake/UuidConfiguration.cmake @ 2514:38d666a40860
fix msvc
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 29 Mar 2018 08:55:32 +0200 |
parents | 47029de27a74 |
children | a29ffb73f6fd |
rev | line source |
---|---|
2450
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 if (STATIC_BUILD OR NOT USE_SYSTEM_UUID) |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 SET(E2FSPROGS_SOURCES_DIR ${CMAKE_BINARY_DIR}/e2fsprogs-1.43.8) |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 SET(E2FSPROGS_URL "http://www.orthanc-server.com/downloads/third-party/e2fsprogs-1.43.8.tar.gz") |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 SET(E2FSPROGS_MD5 "670b7a74a8ead5333acf21b9afc92b3c") |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 DownloadPackage(${E2FSPROGS_MD5} ${E2FSPROGS_URL} "${E2FSPROGS_SOURCES_DIR}") |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 include_directories( |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 ${E2FSPROGS_SOURCES_DIR}/lib |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 ) |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 |
2453
c50413a4092c
missing generated file in e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2452
diff
changeset
|
14 set(UUID_SOURCES |
2450
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 #${E2FSPROGS_SOURCES_DIR}/lib/uuid/tst_uuid.c |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 #${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_time.c |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/clear.c |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/compare.c |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/copy.c |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/gen_uuid.c |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/isnull.c |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/pack.c |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/parse.c |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/unpack.c |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/unparse.c |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 ) |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 |
2455
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
28 check_include_file("net/if.h" HAVE_NET_IF_H) |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
29 check_include_file("net/if_dl.h" HAVE_NET_IF_DL_H) |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
30 check_include_file("netinet/in.h" HAVE_NETINET_IN_H) |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
31 check_include_file("stdlib.h" HAVE_STDLIB_H) |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
32 check_include_file("sys/file.h" HAVE_SYS_FILE_H) |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
33 check_include_file("sys/ioctl.h" HAVE_SYS_IOCTL_H) |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
34 check_include_file("sys/resource.h" HAVE_SYS_RESOURCE_H) |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
35 check_include_file("sys/socket.h" HAVE_SYS_SOCKET_H) |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
36 check_include_file("sys/sockio.h" HAVE_SYS_SOCKIO_H) |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
37 check_include_file("sys/syscall.h" HAVE_SYS_SYSCALL_H) |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
38 check_include_file("sys/time.h" HAVE_SYS_TIME_H) |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
39 check_include_file("sys/un.h" HAVE_SYS_UN_H) |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
40 check_include_file("unistd.h" HAVE_UNISTD_H) |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
41 |
2461 | 42 If (NOT HAVE_NET_IF_H) # This is the case of OpenBSD |
43 unset(HAVE_NET_IF_H CACHE) | |
44 check_include_files("sys/socket.h;net/if.h" HAVE_NET_IF_H) | |
45 endif() | |
46 | |
47 if (NOT HAVE_NETINET_TCP_H) # This is the case of OpenBSD | |
48 unset(HAVE_NETINET_TCP_H CACHE) | |
49 check_include_files("sys/socket.h;netinet/tcp.h" HAVE_NETINET_TCP_H) | |
50 endif() | |
51 | |
2455
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
52 file(WRITE ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h.cmake " |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
53 #cmakedefine HAVE_NET_IF_H \@HAVE_NET_IF_H\@ |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
54 #cmakedefine HAVE_NET_IF_DL_H \@HAVE_NET_IF_DL_H\@ |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
55 #cmakedefine HAVE_NETINET_IN_H \@HAVE_NETINET_IN_H\@ |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
56 #cmakedefine HAVE_STDLIB_H \@HAVE_STDLIB_H \@ |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
57 #cmakedefine HAVE_SYS_FILE_H \@HAVE_SYS_FILE_H\@ |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
58 #cmakedefine HAVE_SYS_IOCTL_H \@HAVE_SYS_IOCTL_H\@ |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
59 #cmakedefine HAVE_SYS_RESOURCE_H \@HAVE_SYS_RESOURCE_H\@ |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
60 #cmakedefine HAVE_SYS_SOCKET_H \@HAVE_SYS_SOCKET_H\@ |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
61 #cmakedefine HAVE_SYS_SOCKIO_H \@HAVE_SYS_SOCKIO_H\@ |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
62 #cmakedefine HAVE_SYS_SYSCALL_H \@HAVE_SYS_SYSCALL_H\@ |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
63 #cmakedefine HAVE_SYS_TIME_H \@HAVE_SYS_TIME_H\@ |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
64 #cmakedefine HAVE_SYS_UN_H \@HAVE_SYS_UN_H\@ |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
65 #cmakedefine HAVE_UNISTD_H \@HAVE_UNISTD_H\@ |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
66 ") |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
67 |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
68 configure_file( |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
69 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h.cmake |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
70 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
71 ) |
6b3c0d5f65af
improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2453
diff
changeset
|
72 |
2453
c50413a4092c
missing generated file in e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2452
diff
changeset
|
73 |
2450
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 configure_file( |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid.h.in |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid.h |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 ) |
2452 | 78 |
79 file(WRITE | |
80 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_types.h | |
81 "#include <stdint.h>\n") | |
2453
c50413a4092c
missing generated file in e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2452
diff
changeset
|
82 |
2452 | 83 #configure_file( |
84 # ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_types.h.in | |
85 # ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_types.h | |
86 # ) | |
2450
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 source_group(ThirdParty\\uuid REGULAR_EXPRESSION ${E2FSPROGS_SOURCES_DIR}/.*) |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 else() |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 CHECK_INCLUDE_FILE(uuid/uuid.h HAVE_UUID_H) |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 if (NOT HAVE_UUID_H) |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 message(FATAL_ERROR "Please install uuid-dev, e2fsprogs (OpenBSD) or e2fsprogs-libuuid (FreeBSD)") |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 endif() |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 check_library_exists(uuid uuid_generate_random "" HAVE_UUID_LIB) |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 if (NOT HAVE_UUID_LIB) |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 message(FATAL_ERROR "Unable to find the uuid library") |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 endif() |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 link_libraries(uuid) |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
102 endif() |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 |
ade8b4ddd8a6
Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
104 endif() |