diff options
author | kinichiro <kinichiro.inoguchi@gmail.com> | 2016-09-06 23:25:28 +0900 |
---|---|---|
committer | Brent Cook <bcook@openbsd.org> | 2016-10-30 21:39:36 -0500 |
commit | 62f2a73061eda53f5d60cfa7fab7dfb6bd7803ad (patch) | |
tree | 3398f894c4658264cdccc7979a82f49463b3a454 /CMakeLists.txt | |
parent | e168f3b0bc437e58f833efcfd2891892cff4e98e (diff) | |
download | portable-62f2a73061eda53f5d60cfa7fab7dfb6bd7803ad.tar.gz portable-62f2a73061eda53f5d60cfa7fab7dfb6bd7803ad.tar.bz2 portable-62f2a73061eda53f5d60cfa7fab7dfb6bd7803ad.zip |
export DLLs functions for MSVC with CMake
- Add 3 DEF files to export functions from Windows DLLs
- Add gettimeofday to crypto/crypto.def (*1)
- Remove gai_strerrorA from tls/tls.def (*1)
- Fix CMakeLists.txt to use DEF files as PRIVATE
- Change DLL import library file name since it duplicates with static library
- Ignore compiler warning C4267, and Edit CMAKE_C_FLAGS not to overwrite it (*1)
- Add USE_SHARED option to build openssl.exe with shared libraries (*1)
(*1) recommended by @mcnameej
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e546ea4..c8fbb1f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -101,6 +101,8 @@ if(MSVC) | |||
101 | # possible loss of data | 101 | # possible loss of data |
102 | "C4244" # 'function' : conversion from 'int' to 'uint8_t', | 102 | "C4244" # 'function' : conversion from 'int' to 'uint8_t', |
103 | # possible loss of data | 103 | # possible loss of data |
104 | "C4267" # conversion from 'size_t' to 'some type that is almost | ||
105 | # certainly safe to convert a size_t to'. | ||
104 | "C4706" # assignment within conditional expression | 106 | "C4706" # assignment within conditional expression |
105 | "C4820" # 'bytes' bytes padding added after construct 'member_name' | 107 | "C4820" # 'bytes' bytes padding added after construct 'member_name' |
106 | "C4996" # 'read': The POSIX name for this item is deprecated. Instead, | 108 | "C4996" # 'read': The POSIX name for this item is deprecated. Instead, |
@@ -108,7 +110,8 @@ if(MSVC) | |||
108 | ) | 110 | ) |
109 | string(REPLACE "C" " -wd" MSVC_DISABLED_WARNINGS_STR | 111 | string(REPLACE "C" " -wd" MSVC_DISABLED_WARNINGS_STR |
110 | ${MSVC_DISABLED_WARNINGS_LIST}) | 112 | ${MSVC_DISABLED_WARNINGS_LIST}) |
111 | set(CMAKE_C_FLAGS "-MP -W4 ${MSVC_DISABLED_WARNINGS_STR}") | 113 | string(REGEX REPLACE "[/-]W[1234][ ]?" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) |
114 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -MP -W4 ${MSVC_DISABLED_WARNINGS_STR}") | ||
112 | endif() | 115 | endif() |
113 | 116 | ||
114 | check_function_exists(asprintf HAVE_ASPRINTF) | 117 | check_function_exists(asprintf HAVE_ASPRINTF) |
@@ -223,7 +226,24 @@ if(ENABLE_ASM) | |||
223 | endif() | 226 | endif() |
224 | endif() | 227 | endif() |
225 | 228 | ||
226 | set(OPENSSL_LIBS ssl crypto) | 229 | if(NOT (CMAKE_SYSTEM_NAME MATCHES "(Darwin|CYGWIN)")) |
230 | set(BUILD_SHARED true) | ||
231 | endif() | ||
232 | |||
233 | # USE_SHARED builds applications (e.g. openssl) using shared LibreSSL. | ||
234 | # By default, applications use LibreSSL static library to avoid dependencies. | ||
235 | # USE_SHARED isn't set by default; use -DUSE_SHARED=ON with CMake to enable. | ||
236 | # Can be helpful for debugging; don't use for public releases. | ||
237 | if(NOT BUILD_SHARED) | ||
238 | set(USE_SHARED off) | ||
239 | endif() | ||
240 | |||
241 | if(USE_SHARED) | ||
242 | set(OPENSSL_LIBS ssl-shared crypto-shared) | ||
243 | else() | ||
244 | set(OPENSSL_LIBS ssl crypto) | ||
245 | endif() | ||
246 | |||
227 | if(CMAKE_HOST_WIN32) | 247 | if(CMAKE_HOST_WIN32) |
228 | set(OPENSSL_LIBS ${OPENSSL_LIBS} ws2_32) | 248 | set(OPENSSL_LIBS ${OPENSSL_LIBS} ws2_32) |
229 | endif() | 249 | endif() |
@@ -240,10 +260,6 @@ if(CMAKE_SYSTEM_NAME MATCHES "SunOS") | |||
240 | set(OPENSSL_LIBS ${OPENSSL_LIBS} nsl socket) | 260 | set(OPENSSL_LIBS ${OPENSSL_LIBS} nsl socket) |
241 | endif() | 261 | endif() |
242 | 262 | ||
243 | if(NOT (CMAKE_SYSTEM_NAME MATCHES "(Darwin|CYGWIN)")) | ||
244 | set(BUILD_SHARED true) | ||
245 | endif() | ||
246 | |||
247 | check_type_size(time_t SIZEOF_TIME_T) | 263 | check_type_size(time_t SIZEOF_TIME_T) |
248 | if(SIZEOF_TIME_T STREQUAL "4") | 264 | if(SIZEOF_TIME_T STREQUAL "4") |
249 | set(SMALL_TIME_T true) | 265 | set(SMALL_TIME_T true) |