File tree 2 files changed +14
-2
lines changed
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ option( CPP-NETLIB_BUILD_SHARED_LIBS "Build cpp-netlib as shared libraries." OFF
11
11
option ( CPP-NETLIB_BUILD_TESTS "Build the cpp-netlib project tests." ON )
12
12
option ( CPP-NETLIB_BUILD_EXAMPLES "Build the cpp-netlib project examples." ON )
13
13
option ( CPP-NETLIB_ENABLE_HTTPS "Build cpp-netlib with support for https if OpenSSL is found." ON )
14
+ option ( CPP-NETLIB_STATIC_OPENSSL "Build cpp-netlib using static OpenSSL" OFF )
15
+ option ( CPP-NETLIB_STATIC_BOOST "Build cpp-netlib using static Boost" OFF )
14
16
15
17
include (GNUInstallDirs)
16
18
@@ -36,8 +38,10 @@ else()
36
38
set (BUILD_SHARED_LIBS OFF )
37
39
endif ()
38
40
39
- # Always use Boost's shared libraries.
40
- set (Boost_USE_STATIC_LIBS OFF )
41
+ # Use Boost's static libraries
42
+ if (CPP-NETLIB_STATIC_BOOST)
43
+ set (Boost_USE_STATIC_LIBS ON )
44
+ endif ()
41
45
42
46
# We need this for all tests to use the dynamic version.
43
47
add_definitions (-DBOOST_TEST_DYN_LINK)
@@ -64,6 +68,9 @@ if (CPP-NETLIB_ENABLE_HTTPS)
64
68
endif ()
65
69
endif ()
66
70
endif ()
71
+ if (CPP-NETLIB_STATIC_OPENSSL)
72
+ set (CMAKE_FIND_LIBRARY_SUFFIXES .a)
73
+ endif ()
67
74
find_package (OpenSSL)
68
75
endif ()
69
76
Original file line number Diff line number Diff line change @@ -32,6 +32,11 @@ set_target_properties(cppnetlib-client-connections
32
32
target_link_libraries (cppnetlib-client-connections ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} )
33
33
if (OPENSSL_FOUND)
34
34
target_link_libraries (cppnetlib-client-connections ${OPENSSL_LIBRARIES} )
35
+ if (CPP-NETLIB_STATIC_OPENSSL)
36
+ if (NOT MSVC AND NOT MINGW AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" ) # dynlinker functions are built into libc on FreeBSD
37
+ target_link_libraries (cppnetlib-client-connections "-ldl" )
38
+ endif ()
39
+ endif ()
35
40
endif ()
36
41
install (TARGETS cppnetlib-client-connections
37
42
EXPORT cppnetlibTargets
You can’t perform that action at this time.
0 commit comments