annotate Resources/CMake/UuidConfiguration.cmake @ 2733:a2536c0d72de Orthanc-1.4.0

set version
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 13 Jul 2018 14:55:47 +0200
parents a29ffb73f6fd
children c226799724bf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
2524
a29ffb73f6fd optimization in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2461
diff changeset
42 if (NOT HAVE_NET_IF_H) # This is the case of OpenBSD
2461
47029de27a74 fix for openbsd
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2455
diff changeset
43 unset(HAVE_NET_IF_H CACHE)
47029de27a74 fix for openbsd
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2455
diff changeset
44 check_include_files("sys/socket.h;net/if.h" HAVE_NET_IF_H)
47029de27a74 fix for openbsd
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2455
diff changeset
45 endif()
47029de27a74 fix for openbsd
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2455
diff changeset
46
47029de27a74 fix for openbsd
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2455
diff changeset
47 if (NOT HAVE_NETINET_TCP_H) # This is the case of OpenBSD
47029de27a74 fix for openbsd
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2455
diff changeset
48 unset(HAVE_NETINET_TCP_H CACHE)
47029de27a74 fix for openbsd
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2455
diff changeset
49 check_include_files("sys/socket.h;netinet/tcp.h" HAVE_NETINET_TCP_H)
47029de27a74 fix for openbsd
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2455
diff changeset
50 endif()
47029de27a74 fix for openbsd
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2455
diff changeset
51
2524
a29ffb73f6fd optimization in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2461
diff changeset
52 if (NOT EXISTS ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h)
a29ffb73f6fd optimization in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2461
diff changeset
53 file(WRITE ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h.cmake "
2455
6b3c0d5f65af improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2453
diff changeset
54 #cmakedefine HAVE_NET_IF_H \@HAVE_NET_IF_H\@
6b3c0d5f65af improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2453
diff changeset
55 #cmakedefine HAVE_NET_IF_DL_H \@HAVE_NET_IF_DL_H\@
6b3c0d5f65af improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2453
diff changeset
56 #cmakedefine HAVE_NETINET_IN_H \@HAVE_NETINET_IN_H\@
6b3c0d5f65af improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2453
diff changeset
57 #cmakedefine HAVE_STDLIB_H \@HAVE_STDLIB_H \@
6b3c0d5f65af improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2453
diff changeset
58 #cmakedefine HAVE_SYS_FILE_H \@HAVE_SYS_FILE_H\@
6b3c0d5f65af improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2453
diff changeset
59 #cmakedefine HAVE_SYS_IOCTL_H \@HAVE_SYS_IOCTL_H\@
6b3c0d5f65af improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2453
diff changeset
60 #cmakedefine HAVE_SYS_RESOURCE_H \@HAVE_SYS_RESOURCE_H\@
6b3c0d5f65af improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2453
diff changeset
61 #cmakedefine HAVE_SYS_SOCKET_H \@HAVE_SYS_SOCKET_H\@
6b3c0d5f65af improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2453
diff changeset
62 #cmakedefine HAVE_SYS_SOCKIO_H \@HAVE_SYS_SOCKIO_H\@
6b3c0d5f65af improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2453
diff changeset
63 #cmakedefine HAVE_SYS_SYSCALL_H \@HAVE_SYS_SYSCALL_H\@
6b3c0d5f65af improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2453
diff changeset
64 #cmakedefine HAVE_SYS_TIME_H \@HAVE_SYS_TIME_H\@
6b3c0d5f65af improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2453
diff changeset
65 #cmakedefine HAVE_SYS_UN_H \@HAVE_SYS_UN_H\@
6b3c0d5f65af improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2453
diff changeset
66 #cmakedefine HAVE_UNISTD_H \@HAVE_UNISTD_H\@
6b3c0d5f65af improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2453
diff changeset
67 ")
2524
a29ffb73f6fd optimization in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2461
diff changeset
68 endif()
a29ffb73f6fd optimization in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2461
diff changeset
69
2455
6b3c0d5f65af improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2453
diff changeset
70 configure_file(
6b3c0d5f65af improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2453
diff changeset
71 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h.cmake
6b3c0d5f65af improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2453
diff changeset
72 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h
6b3c0d5f65af improved e2fsprogs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2453
diff changeset
73 )
2524
a29ffb73f6fd optimization in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2461
diff changeset
74
2450
ade8b4ddd8a6 Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 configure_file(
ade8b4ddd8a6 Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid.h.in
ade8b4ddd8a6 Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid.h
ade8b4ddd8a6 Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 )
2452
383337f21655 fix os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2450
diff changeset
79
2524
a29ffb73f6fd optimization in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2461
diff changeset
80 if (NOT EXISTS ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_types.h)
a29ffb73f6fd optimization in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2461
diff changeset
81 file(WRITE
a29ffb73f6fd optimization in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2461
diff changeset
82 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_types.h
a29ffb73f6fd optimization in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2461
diff changeset
83 "#include <stdint.h>\n")
a29ffb73f6fd optimization in cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2461
diff changeset
84 endif()
2450
ade8b4ddd8a6 Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85
ade8b4ddd8a6 Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 source_group(ThirdParty\\uuid REGULAR_EXPRESSION ${E2FSPROGS_SOURCES_DIR}/.*)
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 else()
ade8b4ddd8a6 Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 CHECK_INCLUDE_FILE(uuid/uuid.h HAVE_UUID_H)
ade8b4ddd8a6 Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 if (NOT HAVE_UUID_H)
ade8b4ddd8a6 Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 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
92 endif()
ade8b4ddd8a6 Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93
ade8b4ddd8a6 Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 check_library_exists(uuid uuid_generate_random "" HAVE_UUID_LIB)
ade8b4ddd8a6 Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 if (NOT HAVE_UUID_LIB)
ade8b4ddd8a6 Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 message(FATAL_ERROR "Unable to find the uuid library")
ade8b4ddd8a6 Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 endif()
ade8b4ddd8a6 Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98
ade8b4ddd8a6 Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 link_libraries(uuid)
ade8b4ddd8a6 Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 endif()
ade8b4ddd8a6 Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101
ade8b4ddd8a6 Static linking against libuuid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 endif()