aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOJ <oj@buffered.io>2020-04-15 13:12:31 +1000
committerOJ <oj@buffered.io>2020-04-15 13:12:31 +1000
commit79fb34a90bfc318ba73445e4db32f5693042493b (patch)
tree664100c1ba9a65ed10e2f965cc062d0b31c808c7
parentceeb3bb4f423db4fc29704aa5a4c577f08103194 (diff)
downloadportable-79fb34a90bfc318ba73445e4db32f5693042493b.tar.gz
portable-79fb34a90bfc318ba73445e4db32f5693042493b.tar.bz2
portable-79fb34a90bfc318ba73445e4db32f5693042493b.zip
Add support for use of static MSVC runtimes
In certain contexts LibreSSL needs to be built with `/MT` instead of `/MD` for inclusion in other projects. These changes allow for the command-line option `USE_STATIC_MSVC_RUNTIMES` to be set to `ON` if the use wishes to generate projects that will build with static runtimes. This feature requires CMAKE version 3.15+, hence the minimum required version has changed as well.
-rw-r--r--CMakeLists.txt8
1 files changed, 7 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e198f7c..a577d29 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
1cmake_minimum_required (VERSION 3.0) 1cmake_minimum_required (VERSION 3.15)
2include(CheckFunctionExists) 2include(CheckFunctionExists)
3include(CheckSymbolExists) 3include(CheckSymbolExists)
4include(CheckLibraryExists) 4include(CheckLibraryExists)
@@ -9,6 +9,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" ${CMAKE_MODULE_PATH})
9include(cmake_export_symbol) 9include(cmake_export_symbol)
10include(GNUInstallDirs) 10include(GNUInstallDirs)
11 11
12cmake_policy(SET CMP0091 NEW)
12project (LibreSSL C ASM) 13project (LibreSSL C ASM)
13 14
14enable_testing() 15enable_testing()
@@ -36,6 +37,11 @@ option(ENABLE_EXTRATESTS "Enable extra tests that may be unreliable on some plat
36option(ENABLE_NC "Enable installing TLS-enabled nc(1)" OFF) 37option(ENABLE_NC "Enable installing TLS-enabled nc(1)" OFF)
37set(OPENSSLDIR ${OPENSSLDIR} CACHE PATH "Set the default openssl directory" FORCE) 38set(OPENSSLDIR ${OPENSSLDIR} CACHE PATH "Set the default openssl directory" FORCE)
38 39
40option(USE_STATIC_MSVC_RUNTIMES "Use /MT instead of /MD in MSVC" OFF)
41if( USE_STATIC_MSVC_RUNTIMES )
42 set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
43endif()
44
39if(NOT LIBRESSL_SKIP_INSTALL) 45if(NOT LIBRESSL_SKIP_INSTALL)
40 set( ENABLE_LIBRESSL_INSTALL ON ) 46 set( ENABLE_LIBRESSL_INSTALL ON )
41endif(NOT LIBRESSL_SKIP_INSTALL) 47endif(NOT LIBRESSL_SKIP_INSTALL)