diff --git a/CMakeLists.txt b/CMakeLists.txt index 45dfa4b5..7e11fb7f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,7 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) endif() option(BOOST_COBALT_USE_BOOST_CONTAINER "Boost.Cobalt: Use boost.container instead of std::pmr" ${BOOST_COBALT_SHOULD_USE_CONTAINER}) +option(BOOST_COBALT_ENABLE_IO_SSL "Boost.Cobalt: Build boost_cobalt_io_ssl target when OpenSSL is available" ON) if (NOT BOOST_COBALT_IS_ROOT) # Generated by `boostdep --cmake cobalt` @@ -112,16 +113,18 @@ if (NOT BOOST_COBALT_IS_ROOT) target_compile_definitions(boost_cobalt_io PRIVATE BOOST_COBALT_IO_SOURCE=1) add_library(Boost::cobalt::io ALIAS boost_cobalt_io) - find_package(OpenSSL) + if (BOOST_COBALT_ENABLE_IO_SSL) + find_package(OpenSSL) - if (OPENSSL_FOUND) - add_library(boost_cobalt_io_ssl - src/io/ssl.cpp - ) + if (OPENSSL_FOUND) + add_library(boost_cobalt_io_ssl + src/io/ssl.cpp + ) - target_link_libraries(boost_cobalt_io_ssl PUBLIC boost_cobalt_io OpenSSL::SSL OpenSSL::Crypto) - target_compile_definitions(boost_cobalt_io_ssl PRIVATE BOOST_COBALT_SSL_SOURCE=1) - add_library(Boost::cobalt::io::ssl ALIAS boost_cobalt_io_ssl) + target_link_libraries(boost_cobalt_io_ssl PUBLIC boost_cobalt_io OpenSSL::SSL OpenSSL::Crypto) + target_compile_definitions(boost_cobalt_io_ssl PRIVATE BOOST_COBALT_SSL_SOURCE=1) + add_library(Boost::cobalt::io::ssl ALIAS boost_cobalt_io_ssl) + endif() endif() if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt") @@ -244,14 +247,16 @@ else() target_compile_definitions(boost_cobalt_io PRIVATE BOOST_COBALT_IO_SOURCE=1) add_library(Boost::cobalt::io ALIAS boost_cobalt_io) - find_package(OpenSSL) + if (BOOST_COBALT_ENABLE_IO_SSL) + find_package(OpenSSL) - if (OPENSSL_FOUND) - add_library(boost_cobalt_io_ssl src/io/ssl.cpp) + if (OPENSSL_FOUND) + add_library(boost_cobalt_io_ssl src/io/ssl.cpp) - target_link_libraries(boost_cobalt_io_ssl PUBLIC boost_cobalt_io OpenSSL::SSL OpenSSL::Crypto) - target_compile_definitions(boost_cobalt_io_ssl PRIVATE BOOST_COBALT_SSL_SOURCE=1) - add_library(Boost::cobalt::io::ssl ALIAS boost_cobalt_io_ssl) + target_link_libraries(boost_cobalt_io_ssl PUBLIC boost_cobalt_io OpenSSL::SSL OpenSSL::Crypto) + target_compile_definitions(boost_cobalt_io_ssl PRIVATE BOOST_COBALT_SSL_SOURCE=1) + add_library(Boost::cobalt::io::ssl ALIAS boost_cobalt_io_ssl) + endif() endif() if(BOOST_COBALT_INSTALL AND NOT BOOST_SUPERPROJECT_VERSION) diff --git a/boost-cobalt.jam b/boost-cobalt.jam index e0820f52..dba3225b 100644 --- a/boost-cobalt.jam +++ b/boost-cobalt.jam @@ -9,4 +9,5 @@ import feature ; feature.feature boost.cobalt.pmr : std boost-container custom no : propagated ; feature.feature boost.cobalt.executor : any_io_executor use_io_context custom : propagated ; +feature.feature boost.cobalt.ssl : auto on off : propagated ; diff --git a/build.jam b/build.jam index 071a6164..1e07e025 100644 --- a/build.jam +++ b/build.jam @@ -34,7 +34,9 @@ project /boost/cobalt explicit [ alias boost_cobalt : build//boost_cobalt ] [ alias boost_cobalt_io : build//boost_cobalt_io ] - [ alias boost_cobalt_io_ssl : build//boost_cobalt_io_ssl ] + [ alias boost_cobalt_io_ssl : build//boost_cobalt_io_ssl + : off:no + ] [ alias all : boost_cobalt boost_cobalt_io test example ] ; diff --git a/build/Jamfile b/build/Jamfile index f90c69d8..7c304bd3 100644 --- a/build/Jamfile +++ b/build/Jamfile @@ -116,6 +116,7 @@ lib boost_cobalt_io_ssl : io/ssl.cpp boost_cobalt_io : requirements BOOST_COBALT_SSL_SOURCE=1 shared:BOOST_COBALT_DYN_LINK=1 + off:no [ ac.check-library /openssl//ssl : /openssl//ssl/shared : no ] [ ac.check-library /openssl//crypto : /openssl//crypto/shared : no ] : usage-requirements