diff options
Diffstat (limited to '')
-rw-r--r-- | CMakeLists.txt | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..e642bcc --- /dev/null +++ b/CMakeLists.txt | |||
@@ -0,0 +1,130 @@ | |||
1 | cmake_minimum_required (VERSION 3.2) | ||
2 | include(CheckFunctionExists) | ||
3 | |||
4 | project (LibreSSL) | ||
5 | |||
6 | if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD") | ||
7 | add_definitions(-DHAVE_ATTRIBUTE__BOUNDED__) | ||
8 | endif() | ||
9 | |||
10 | add_definitions(-DLIBRESSL_INTERNAL) | ||
11 | add_definitions(-DOPENSSL_NO_HW_PADLOCK) | ||
12 | add_definitions(-DOPENSSL_NO_ASM) | ||
13 | |||
14 | if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") | ||
15 | add_definitions(-Wno-pointer-sign) | ||
16 | endif() | ||
17 | |||
18 | if(MSVC) | ||
19 | add_definitions(-Dinline=__inline) | ||
20 | add_definitions(-Drestrict) | ||
21 | add_definitions(-D_CRT_SECURE_NO_WARNINGS) | ||
22 | add_definitions(-D_CRT_DEPRECATED_NO_WARNINGS) | ||
23 | add_definitions(-D_REENTRANT -D_POSIX_THREAD_SAFE_FUNCTIONS) | ||
24 | add_definitions(-DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0501) | ||
25 | add_definitions(-DCPPFLAGS -DOPENSSL_NO_SPEED -DNO_SYSLOG -DNO_CRYPT) | ||
26 | |||
27 | set(MSVC_DISABLED_WARNINGS_LIST | ||
28 | "C4057" # C4057: 'initializing' : 'unsigned char *' differs in | ||
29 | # indirection to slightly different base types from 'char [2]' | ||
30 | "C4100" # 'exarg' : unreferenced formal parameter | ||
31 | "C4127" # conditional expression is constant | ||
32 | "C4242" # 'function' : conversion from 'int' to 'uint8_t', | ||
33 | # possible loss of data | ||
34 | "C4244" # 'function' : conversion from 'int' to 'uint8_t', | ||
35 | # possible loss of data | ||
36 | "C4706" # assignment within conditional expression | ||
37 | "C4820" # 'bytes' bytes padding added after construct 'member_name' | ||
38 | "C4996" # 'read': The POSIX name for this item is deprecated. Instead, | ||
39 | # use the ISO C++ conformant name: _read. | ||
40 | ) | ||
41 | string(REPLACE "C" " -wd" MSVC_DISABLED_WARNINGS_STR | ||
42 | ${MSVC_DISABLED_WARNINGS_LIST}) | ||
43 | set(CMAKE_C_FLAGS "-MP -W4 ${MSVC_DISABLED_WARNINGS_STR}") | ||
44 | endif() | ||
45 | |||
46 | check_function_exists(asprintf HAVE_ASPRINTF) | ||
47 | if(HAVE_ASPRINTF) | ||
48 | add_definitions(-DHAVE_ASPRINTF) | ||
49 | endif() | ||
50 | |||
51 | check_function_exists(inet_pton HAVE_INET_PTON) | ||
52 | if(HAVE_INET_PTON) | ||
53 | add_definitions(-DHAVE_INET_PTON) | ||
54 | endif() | ||
55 | |||
56 | check_function_exists(reallocarray HAVE_REALLOCARRAY) | ||
57 | if(HAVE_REALLOCARRAY) | ||
58 | add_definitions(-DHAVE_REALLOCARRAY) | ||
59 | endif() | ||
60 | |||
61 | check_function_exists(strcasecmp HAVE_STRCASECMP) | ||
62 | if(HAVE_STRCASECMP) | ||
63 | add_definitions(-DHAVE_STRCASECMP) | ||
64 | endif() | ||
65 | |||
66 | check_function_exists(strlcat HAVE_STRLCAT) | ||
67 | if(HAVE_STRLCAT) | ||
68 | add_definitions(-DHAVE_STRLCAT) | ||
69 | endif() | ||
70 | |||
71 | check_function_exists(strlcat HAVE_STRLCPY) | ||
72 | if(HAVE_STRLCPY) | ||
73 | add_definitions(-DHAVE_STRLCPY) | ||
74 | endif() | ||
75 | |||
76 | check_function_exists(strndup HAVE_STRNDUP) | ||
77 | if(HAVE_STRNDUP) | ||
78 | add_definitions(-DHAVE_STRNDUP) | ||
79 | endif() | ||
80 | |||
81 | if(MSVC) | ||
82 | set(HAVE_STRNLEN) | ||
83 | add_definitions(-DHAVE_STRNLEN) | ||
84 | else() | ||
85 | check_function_exists(strnlen HAVE_STRNLEN) | ||
86 | if(HAVE_STRNLEN) | ||
87 | add_definitions(-DHAVE_STRNLEN) | ||
88 | endif() | ||
89 | endif() | ||
90 | |||
91 | check_function_exists(strsep HAVE_STRSEP) | ||
92 | if(HAVE_STRSEP) | ||
93 | add_definitions(-DHAVE_STRSEP) | ||
94 | endif() | ||
95 | |||
96 | check_function_exists(arc4random_buf HAVE_ARC4RANDOM_BUF) | ||
97 | if(HAVE_ARC4RANDOM_BUF) | ||
98 | add_definitions(-DHAVE_ARC4RANDOM_BUF) | ||
99 | endif() | ||
100 | |||
101 | check_function_exists(explicit_bzero HAVE_EXPLICIT_BZERO) | ||
102 | if(HAVE_EXPLICIT_BZERO) | ||
103 | add_definitions(-DHAVE_EXPLICIT_BZERO) | ||
104 | endif() | ||
105 | |||
106 | check_function_exists(getauxval HAVE_GETAUXVAL) | ||
107 | if(HAVE_GETAUXVAL) | ||
108 | add_definitions(-DHAVE_GETAUXVAL) | ||
109 | endif() | ||
110 | |||
111 | check_function_exists(getentropy HAVE_GETENTROPY) | ||
112 | if(HAVE_GETENTROPY) | ||
113 | add_definitions(-DHAVE_GETENTROPY) | ||
114 | endif() | ||
115 | |||
116 | check_function_exists(timingsafe_bcmp HAVE_TIMINGSAFE_BCMP) | ||
117 | if(HAVE_TIMINGSAFE_BCMP) | ||
118 | add_definitions(-DHAVE_TIMINGSAFE_BCMP) | ||
119 | endif() | ||
120 | |||
121 | check_function_exists(timingsafe_memcmp HAVE_TIMINGSAFE_MEMCMP) | ||
122 | if(HAVE_MEMCMP) | ||
123 | add_definitions(-DHAVE_MEMCMP) | ||
124 | endif() | ||
125 | |||
126 | add_subdirectory(crypto) | ||
127 | add_subdirectory(ssl) | ||
128 | add_subdirectory(apps) | ||
129 | add_subdirectory(tls) | ||
130 | add_subdirectory(tests) | ||