aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorkinichiro <kinichiro.inoguchi@gmail.com>2016-09-06 23:25:28 +0900
committerBrent Cook <bcook@openbsd.org>2016-10-30 21:39:36 -0500
commit62f2a73061eda53f5d60cfa7fab7dfb6bd7803ad (patch)
tree3398f894c4658264cdccc7979a82f49463b3a454 /CMakeLists.txt
parente168f3b0bc437e58f833efcfd2891892cff4e98e (diff)
downloadportable-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.txt28
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}")
112endif() 115endif()
113 116
114check_function_exists(asprintf HAVE_ASPRINTF) 117check_function_exists(asprintf HAVE_ASPRINTF)
@@ -223,7 +226,24 @@ if(ENABLE_ASM)
223 endif() 226 endif()
224endif() 227endif()
225 228
226set(OPENSSL_LIBS ssl crypto) 229if(NOT (CMAKE_SYSTEM_NAME MATCHES "(Darwin|CYGWIN)"))
230 set(BUILD_SHARED true)
231endif()
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.
237if(NOT BUILD_SHARED)
238 set(USE_SHARED off)
239endif()
240
241if(USE_SHARED)
242 set(OPENSSL_LIBS ssl-shared crypto-shared)
243else()
244 set(OPENSSL_LIBS ssl crypto)
245endif()
246
227if(CMAKE_HOST_WIN32) 247if(CMAKE_HOST_WIN32)
228 set(OPENSSL_LIBS ${OPENSSL_LIBS} ws2_32) 248 set(OPENSSL_LIBS ${OPENSSL_LIBS} ws2_32)
229endif() 249endif()
@@ -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)
241endif() 261endif()
242 262
243if(NOT (CMAKE_SYSTEM_NAME MATCHES "(Darwin|CYGWIN)"))
244 set(BUILD_SHARED true)
245endif()
246
247check_type_size(time_t SIZEOF_TIME_T) 263check_type_size(time_t SIZEOF_TIME_T)
248if(SIZEOF_TIME_T STREQUAL "4") 264if(SIZEOF_TIME_T STREQUAL "4")
249 set(SMALL_TIME_T true) 265 set(SMALL_TIME_T true)