diff options
author | OJ <oj@buffered.io> | 2020-04-15 13:12:31 +1000 |
---|---|---|
committer | OJ <oj@buffered.io> | 2020-04-15 13:12:31 +1000 |
commit | 79fb34a90bfc318ba73445e4db32f5693042493b (patch) | |
tree | 664100c1ba9a65ed10e2f965cc062d0b31c808c7 | |
parent | ceeb3bb4f423db4fc29704aa5a4c577f08103194 (diff) | |
download | portable-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.txt | 8 |
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 @@ | |||
1 | cmake_minimum_required (VERSION 3.0) | 1 | cmake_minimum_required (VERSION 3.15) |
2 | include(CheckFunctionExists) | 2 | include(CheckFunctionExists) |
3 | include(CheckSymbolExists) | 3 | include(CheckSymbolExists) |
4 | include(CheckLibraryExists) | 4 | include(CheckLibraryExists) |
@@ -9,6 +9,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" ${CMAKE_MODULE_PATH}) | |||
9 | include(cmake_export_symbol) | 9 | include(cmake_export_symbol) |
10 | include(GNUInstallDirs) | 10 | include(GNUInstallDirs) |
11 | 11 | ||
12 | cmake_policy(SET CMP0091 NEW) | ||
12 | project (LibreSSL C ASM) | 13 | project (LibreSSL C ASM) |
13 | 14 | ||
14 | enable_testing() | 15 | enable_testing() |
@@ -36,6 +37,11 @@ option(ENABLE_EXTRATESTS "Enable extra tests that may be unreliable on some plat | |||
36 | option(ENABLE_NC "Enable installing TLS-enabled nc(1)" OFF) | 37 | option(ENABLE_NC "Enable installing TLS-enabled nc(1)" OFF) |
37 | set(OPENSSLDIR ${OPENSSLDIR} CACHE PATH "Set the default openssl directory" FORCE) | 38 | set(OPENSSLDIR ${OPENSSLDIR} CACHE PATH "Set the default openssl directory" FORCE) |
38 | 39 | ||
40 | option(USE_STATIC_MSVC_RUNTIMES "Use /MT instead of /MD in MSVC" OFF) | ||
41 | if( USE_STATIC_MSVC_RUNTIMES ) | ||
42 | set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") | ||
43 | endif() | ||
44 | |||
39 | if(NOT LIBRESSL_SKIP_INSTALL) | 45 | if(NOT LIBRESSL_SKIP_INSTALL) |
40 | set( ENABLE_LIBRESSL_INSTALL ON ) | 46 | set( ENABLE_LIBRESSL_INSTALL ON ) |
41 | endif(NOT LIBRESSL_SKIP_INSTALL) | 47 | endif(NOT LIBRESSL_SKIP_INSTALL) |