aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorBrent Cook <bcook@openbsd.org>2018-03-25 19:21:16 -0500
committerBrent Cook <bcook@openbsd.org>2018-03-25 19:21:16 -0500
commit55c0cacca0fe675a15389dc175088528a5d2cd00 (patch)
treed7fe59187a56f99a6f1781f6028280e2747a2797 /CMakeLists.txt
parent89e5bc52275019dccc608b6a3998fda5c2e1e604 (diff)
parent4d753badc09cca1a85c4fb7f404bae2d6ed51f5f (diff)
downloadportable-55c0cacca0fe675a15389dc175088528a5d2cd00.tar.gz
portable-55c0cacca0fe675a15389dc175088528a5d2cd00.tar.bz2
portable-55c0cacca0fe675a15389dc175088528a5d2cd00.zip
Land #406, use BUILD_SHARED_LIBS
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt23
1 files changed, 4 insertions, 19 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 03c87a4..1c6bd67 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,10 +29,10 @@ string(REGEX REPLACE "\\..*" "" TLS_MAJOR_VERSION ${TLS_VERSION})
29 29
30option(LIBRESSL_SKIP_INSTALL "Skip installation" ${LIBRESSL_SKIP_INSTALL}) 30option(LIBRESSL_SKIP_INSTALL "Skip installation" ${LIBRESSL_SKIP_INSTALL})
31option(LIBRESSL_APPS "Build apps" ON) 31option(LIBRESSL_APPS "Build apps" ON)
32option(LIBRESSL_TESTS "Build tests" ON)
32option(ENABLE_ASM "Enable assembly" ON) 33option(ENABLE_ASM "Enable assembly" ON)
33option(ENABLE_EXTRATESTS "Enable extra tests that may be unreliable on some platforms" OFF) 34option(ENABLE_EXTRATESTS "Enable extra tests that may be unreliable on some platforms" OFF)
34option(ENABLE_NC "Enable installing TLS-enabled nc(1)" OFF) 35option(ENABLE_NC "Enable installing TLS-enabled nc(1)" OFF)
35option(ENABLE_VSTEST "Enable test on Visual Studio" OFF)
36set(OPENSSLDIR ${OPENSSLDIR} CACHE PATH "Set the default openssl directory" FORCE) 36set(OPENSSLDIR ${OPENSSLDIR} CACHE PATH "Set the default openssl directory" FORCE)
37 37
38if(NOT LIBRESSL_SKIP_INSTALL) 38if(NOT LIBRESSL_SKIP_INSTALL)
@@ -262,23 +262,7 @@ if(ENABLE_ASM)
262 endif() 262 endif()
263endif() 263endif()
264 264
265if(NOT (CMAKE_SYSTEM_NAME MATCHES "(Darwin|CYGWIN)")) 265set(OPENSSL_LIBS tls ssl crypto)
266 set(BUILD_SHARED true)
267endif()
268
269# USE_SHARED builds applications (e.g. openssl) using shared LibreSSL.
270# By default, applications use LibreSSL static library to avoid dependencies.
271# USE_SHARED isn't set by default; use -DUSE_SHARED=ON with CMake to enable.
272# Can be helpful for debugging; don't use for public releases.
273if(NOT BUILD_SHARED)
274 set(USE_SHARED off)
275endif()
276
277if(USE_SHARED)
278 set(OPENSSL_LIBS tls-shared ssl-shared crypto-shared)
279else()
280 set(OPENSSL_LIBS tls ssl crypto)
281endif()
282 266
283if(WIN32) 267if(WIN32)
284 set(OPENSSL_LIBS ${OPENSSL_LIBS} ws2_32) 268 set(OPENSSL_LIBS ${OPENSSL_LIBS} ws2_32)
@@ -322,7 +306,8 @@ add_subdirectory(include)
322if(NOT MSVC) 306if(NOT MSVC)
323 add_subdirectory(man) 307 add_subdirectory(man)
324endif() 308endif()
325if(NOT MSVC OR ENABLE_VSTEST) 309# Tests require the openssl executable and are unavailable when building shared libraries
310if(LIBRESSL_APPS AND LIBRESSL_TESTS AND NOT BUILD_SHARED_LIBS)
326 add_subdirectory(tests) 311 add_subdirectory(tests)
327endif() 312endif()
328 313