Skip to content

Commit 3d823f5

Browse files
author
Hannes Rantzsch
committed
cmake: compile definition to enforce botan stream
1 parent c9707ef commit 3d823f5

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

Release/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ endif()
6262
include(cmake/cpprest_find_boost.cmake)
6363
include(cmake/cpprest_find_zlib.cmake)
6464
include(cmake/cpprest_find_openssl.cmake)
65+
include(cmake/cpprest_find_botan.cmake)
6566
include(cmake/cpprest_find_websocketpp.cmake)
6667
include(cmake/cpprest_find_brotli.cmake)
6768
include(CheckIncludeFiles)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
function(cpprest_find_botan)
2+
if(TARGET cpprestsdk_botan_internal)
3+
return()
4+
endif()
5+
6+
# TODO: this does not make sure Botan is set and does not fail at configure time
7+
set(CMAKE_REQUIRED_INCLUDES "${BOTAN_INCLUDE_DIR}")
8+
set(CMAKE_REQUIRED_LIBRARIES "${BOTAN_LIBRARY}")
9+
10+
add_library(cpprestsdk_botan_internal INTERFACE)
11+
target_link_libraries(cpprestsdk_botan_internal INTERFACE "$<BUILD_INTERFACE:${BOTAN_LIBRARY}>")
12+
target_include_directories(cpprestsdk_botan_internal INTERFACE "$<BUILD_INTERFACE:${BOTAN_INCLUDE_DIR}>")
13+
endfunction()

Release/src/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,10 @@ endif()
128128
if(CPPREST_HTTP_CLIENT_IMPL STREQUAL "asio")
129129
cpprest_find_boost()
130130
cpprest_find_openssl()
131-
target_compile_definitions(cpprest PUBLIC -DCPPREST_FORCE_HTTP_CLIENT_ASIO)
131+
cpprest_find_botan()
132+
target_compile_definitions(cpprest PUBLIC -DCPPREST_BOTAN_SSL -DCPPREST_FORCE_HTTP_CLIENT_ASIO)
132133
target_sources(cpprest PRIVATE http/client/http_client_asio.cpp http/client/x509_cert_utilities.cpp)
133-
target_link_libraries(cpprest PUBLIC cpprestsdk_boost_internal cpprestsdk_openssl_internal)
134+
target_link_libraries(cpprest PUBLIC cpprestsdk_boost_internal cpprestsdk_openssl_internal cpprestsdk_botan_internal)
134135
elseif(CPPREST_HTTP_CLIENT_IMPL STREQUAL "winhttp")
135136
target_link_libraries(cpprest PRIVATE
136137
httpapi.lib
@@ -248,6 +249,7 @@ if(CPPREST_INSTALL)
248249
set(CPPREST_USES_ZLIB OFF)
249250
set(CPPREST_USES_BROTLI OFF)
250251
set(CPPREST_USES_OPENSSL OFF)
252+
set(CPPREST_USES_BOTAN OFF)
251253

252254
set(CPPREST_TARGETS cpprest)
253255
if(TARGET cpprestsdk_boost_internal)
@@ -266,6 +268,10 @@ if(CPPREST_INSTALL)
266268
list(APPEND CPPREST_TARGETS cpprestsdk_openssl_internal)
267269
set(CPPREST_USES_OPENSSL ON)
268270
endif()
271+
if(TARGET cpprestsdk_botan_internal)
272+
list(APPEND CPPREST_TARGETS cpprestsdk_botan_internal)
273+
set(CPPREST_USES_BOTAN ON)
274+
endif()
269275
if(TARGET cpprestsdk_websocketpp_internal)
270276
list(APPEND CPPREST_TARGETS cpprestsdk_websocketpp_internal)
271277
endif()

0 commit comments

Comments
 (0)