1
- cmake_minimum_required (VERSION 3.0)
1
+ if (MSVC )
2
+ cmake_minimum_required (VERSION 3.16.4)
3
+ cmake_policy (SET CMP0091 NEW)
4
+ else ()
5
+ cmake_minimum_required (VERSION 3.0)
6
+ endif ()
7
+
8
+ project (LibreSSL C ASM)
9
+
2
10
include (CheckFunctionExists)
3
11
include (CheckSymbolExists)
4
12
include (CheckLibraryExists)
@@ -9,8 +17,6 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" ${CMAKE_MODULE_PATH})
9
17
include (cmake_export_symbol)
10
18
include (GNUInstallDirs)
11
19
12
- project (LibreSSL C ASM)
13
-
14
20
enable_testing ()
15
21
16
22
file (READ ${CMAKE_CURRENT_SOURCE_DIR} /ssl/VERSION SSL_VERSION)
@@ -36,6 +42,11 @@ option(ENABLE_EXTRATESTS "Enable extra tests that may be unreliable on some plat
36
42
option (ENABLE_NC "Enable installing TLS-enabled nc(1)" OFF )
37
43
set (OPENSSLDIR ${OPENSSLDIR} CACHE PATH "Set the default openssl directory" FORCE)
38
44
45
+ option (USE_STATIC_MSVC_RUNTIMES "Use /MT instead of /MD in MSVC" OFF )
46
+ if (USE_STATIC_MSVC_RUNTIMES)
47
+ set (CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>" )
48
+ endif ()
49
+
39
50
if (NOT LIBRESSL_SKIP_INSTALL)
40
51
set ( ENABLE_LIBRESSL_INSTALL ON )
41
52
endif (NOT LIBRESSL_SKIP_INSTALL)
@@ -108,7 +119,7 @@ if(WIN32)
108
119
add_definitions (-D_REENTRANT -D_POSIX_THREAD_SAFE_FUNCTIONS)
109
120
add_definitions (-DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0600)
110
121
add_definitions (-DCPPFLAGS -DNO_SYSLOG -DNO_CRYPT)
111
- set (PLATFORM_LIBS ${PLATFORM_LIBS} ws2_32)
122
+ set (PLATFORM_LIBS ${PLATFORM_LIBS} ws2_32 bcrypt )
112
123
endif ()
113
124
114
125
if (MSVC )
@@ -289,7 +300,7 @@ if(ENABLE_ASM)
289
300
endif ()
290
301
elseif (APPLE AND "${CMAKE_SYSTEM_PROCESSOR} " STREQUAL "x86_64" )
291
302
set (HOST_ASM_MACOSX_X86_64 true )
292
- elseif (MSVC AND "${CMAKE_GENERATOR} " MATCHES "Win64" )
303
+ elseif (MSVC AND ( "${CMAKE_GENERATOR} " MATCHES "Win64" OR " ${CMAKE_GENERATOR_PLATFORM} " STREQUAL "x64" ) )
293
304
set (HOST_ASM_MASM_X86_64 true )
294
305
ENABLE_LANGUAGE (ASM_MASM)
295
306
elseif (CMAKE_SYSTEM_NAME MATCHES "MINGW" AND "${CMAKE_SYSTEM_PROCESSOR} " STREQUAL "x86_64" )
@@ -357,6 +368,17 @@ if(NOT MSVC)
357
368
DESTINATION ${CMAKE_INSTALL_LIBDIR} )
358
369
endif ()
359
370
371
+ if (NOT "${OPENSSLDIR} " STREQUAL "" )
372
+ set (CONF_DIR "${OPENSSLDIR} " )
373
+ else ()
374
+ set (CONF_DIR "${CMAKE_INSTALL_PREFIX} /etc/ssl" )
375
+ endif ()
376
+
377
+ if (ENABLE_LIBRESSL_INSTALL)
378
+ install (FILES cert.pem openssl.cnf x509v3.cnf DESTINATION ${CONF_DIR} )
379
+ install (DIRECTORY DESTINATION ${CONF_DIR} /certs)
380
+ endif (ENABLE_LIBRESSL_INSTALL)
381
+
360
382
if (NOT TARGET uninstall)
361
383
configure_file (
362
384
"${CMAKE_CURRENT_SOURCE_DIR} /cmake_uninstall.cmake.in"
0 commit comments