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 @@ -12,6 +12,8 @@ option( CPP-NETLIB_BUILD_TESTS "Build the cpp-netlib project tests." ON)
12
12
# option( CPP-NETLIB_BUILD_EXPERIMENTS "Build the cpp-netlib project experiments." ON)
13
13
option ( CPP-NETLIB_BUILD_EXAMPLES "Build the cpp-netlib project examples." ON )
14
14
option ( CPP-NETLIB_ENABLE_HTTPS "Build cpp-netlib with support for https if OpenSSL is found." ON )
15
+ option ( CPP-NETLIB_STATIC_OPENSSL "Build cpp-netlib using static OpenSSL" OFF )
16
+ option ( CPP-NETLIB_STATIC_BOOST "Build cpp-netlib using static Boost" OFF )
15
17
16
18
include (GNUInstallDirs)
17
19
@@ -37,8 +39,10 @@ else()
37
39
set (BUILD_SHARED_LIBS OFF )
38
40
endif ()
39
41
40
- # Always use Boost's shared libraries.
41
- set (Boost_USE_STATIC_LIBS OFF )
42
+ # Use Boost's static libraries
43
+ if (CPP-NETLIB_STATIC_BOOST)
44
+ set (Boost_USE_STATIC_LIBS ON )
45
+ endif ()
42
46
43
47
# We need this for all tests to use the dynamic version.
44
48
add_definitions (-DBOOST_TEST_DYN_LINK)
@@ -65,6 +69,9 @@ if (CPP-NETLIB_ENABLE_HTTPS)
65
69
endif ()
66
70
endif ()
67
71
endif ()
72
+ if (CPP-NETLIB_STATIC_OPENSSL)
73
+ set (CMAKE_FIND_LIBRARY_SUFFIXES .a)
74
+ endif ()
68
75
find_package (OpenSSL)
69
76
endif ()
70
77
Original file line number Diff line number Diff line change @@ -45,6 +45,11 @@ set_target_properties(cppnetlib-client-connections
45
45
target_link_libraries (cppnetlib-client-connections ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} )
46
46
if (OPENSSL_FOUND)
47
47
target_link_libraries (cppnetlib-client-connections ${OPENSSL_LIBRARIES} )
48
+ if (CPP-NETLIB_STATIC_OPENSSL)
49
+ if (NOT MSVC AND NOT MINGW AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" ) # dynlinker functions are built into libc on FreeBSD
50
+ target_link_libraries (cppnetlib-client-connections "-ldl" )
51
+ endif ()
52
+ endif ()
48
53
endif ()
49
54
if (MINGW)
50
55
target_link_libraries (cppnetlib-client-connections ws2_32)
You can’t perform that action at this time.
0 commit comments