Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2b910a6

Browse files
authored
Merge pull request#724 from anonimal/static-dependencies
Build: allow options to use Boost + OpenSSL static libs
2 parents8ed4591 +06e23a7 commit2b910a6

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

‎CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ option( CPP-NETLIB_BUILD_SHARED_LIBS "Build cpp-netlib as shared libraries." OFF
1111
option(CPP-NETLIB_BUILD_TESTS"Build the cpp-netlib project tests."ON)
1212
option(CPP-NETLIB_BUILD_EXAMPLES"Build the cpp-netlib project examples."ON)
1313
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)
1416

1517
include(GNUInstallDirs)
1618

@@ -36,8 +38,10 @@ else()
3638
set(BUILD_SHARED_LIBSOFF)
3739
endif()
3840

39-
# Always use Boost's shared libraries.
40-
set(Boost_USE_STATIC_LIBSOFF)
41+
# Use Boost's static libraries
42+
if (CPP-NETLIB_STATIC_BOOST)
43+
set(Boost_USE_STATIC_LIBSON)
44+
endif()
4145

4246
# We need this for all tests to use the dynamic version.
4347
add_definitions(-DBOOST_TEST_DYN_LINK)
@@ -64,6 +68,9 @@ if (CPP-NETLIB_ENABLE_HTTPS)
6468
endif()
6569
endif()
6670
endif()
71+
if (CPP-NETLIB_STATIC_OPENSSL)
72+
set(CMAKE_FIND_LIBRARY_SUFFIXES.a)
73+
endif()
6774
find_package(OpenSSL)
6875
endif()
6976

‎libs/network/src/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ set_target_properties(cppnetlib-client-connections
3232
target_link_libraries(cppnetlib-client-connections${Boost_LIBRARIES}${CMAKE_THREAD_LIBS_INIT})
3333
if (OPENSSL_FOUND)
3434
target_link_libraries(cppnetlib-client-connections${OPENSSL_LIBRARIES})
35+
if (CPP-NETLIB_STATIC_OPENSSL)
36+
if (NOTMSVCANDNOTMINGWANDNOT${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()
3540
endif ()
3641
install(TARGETScppnetlib-client-connections
3742
EXPORTcppnetlibTargets

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp