[boost-cobalt] add missing boost_cobalt_io target, add ssl feature (#53001)

This commit is contained in:
miyan 2026-07-27 13:02:58 +08:00 committed by GitHub
parent af4d2e5140
commit 4280de21ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 114 additions and 3 deletions

View File

@ -0,0 +1,6 @@
vcpkg_check_features(
OUT_FEATURE_OPTIONS
FEATURE_OPTIONS
FEATURES
"ssl" BOOST_COBALT_ENABLE_IO_SSL
)

View File

@ -0,0 +1,80 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- 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" ON)
if (NOT BOOST_COBALT_IS_ROOT)
# Generated by `boostdep --cmake cobalt`
@@ -112,16 +113,29 @@ 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 CONFIG REQUIRED)
- if (OPENSSL_FOUND)
- add_library(boost_cobalt_io_ssl
- src/io/ssl.cpp
- )
+ 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)
+ endif()
+
+ if (BOOST_SUPERPROJECT_VERSION AND NOT CMAKE_VERSION VERSION_LESS 3.13)
+ set(boost_cobalt_install_targets boost_cobalt boost_cobalt_io)
+ if (TARGET boost_cobalt_io_ssl)
+ list(APPEND boost_cobalt_install_targets boost_cobalt_io_ssl)
+ endif()
- 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)
+ boost_install(
+ TARGETS ${boost_cobalt_install_targets}
+ VERSION "${BOOST_SUPERPROJECT_VERSION}"
+ HEADER_DIRECTORY include
+ )
endif()
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
@@ -244,18 +258,23 @@ 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 CONFIG REQUIRED)
- if (OPENSSL_FOUND)
- add_library(boost_cobalt_io_ssl src/io/ssl.cpp)
+ 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()
if(BOOST_COBALT_INSTALL AND NOT BOOST_SUPERPROJECT_VERSION)
- install(TARGETS boost_cobalt boost_cobalt_io
+ set(boost_cobalt_install_targets boost_cobalt boost_cobalt_io)
+ if (TARGET boost_cobalt_io_ssl)
+ list(APPEND boost_cobalt_install_targets boost_cobalt_io_ssl)
+ endif()
+
+ install(TARGETS ${boost_cobalt_install_targets}
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"

View File

@ -8,9 +8,11 @@ vcpkg_from_github(
HEAD_REF master
PATCHES
fail-on-compiler-not-supported.patch
install-cobalt-io.patch
)
set(FEATURE_OPTIONS "")
include("${CMAKE_CURRENT_LIST_DIR}/features.cmake")
boost_configure_and_install(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS ${FEATURE_OPTIONS}

View File

@ -2,6 +2,7 @@
"$comment": "Automatically generated by scripts/boost/generate-ports.ps1",
"name": "boost-cobalt",
"version": "1.91.0",
"port-version": 1,
"description": "Boost cobalt module",
"homepage": "https://www.boost.org/library/latest/cobalt/",
"documentation": "https://www.boost.org/libs/cobalt",
@ -81,5 +82,13 @@
"name": "boost-variant2",
"version>=": "1.91.0"
}
]
],
"features": {
"ssl": {
"description": "Build boost_cobalt_io_ssl",
"dependencies": [
"openssl"
]
}
}
}

View File

@ -37,6 +37,7 @@ $semverVersion = ($version -replace '(\d+(\.\d+){1,3}).*', '$1')
# Clear this array when moving to a new boost version
$defaultPortVersion = 0
$portVersions = @{
'boost-cobalt' = 1
}
function Get-PortVersion {
@ -80,7 +81,15 @@ $portData = @{
};
'boost-beast' = @{ 'supports' = '!emscripten' };
'boost-cmake' = @{ 'dependencies' = @(@{ 'name' = 'vcpkg-boost'; 'host' = $true }); };
'boost-cobalt' = @{ 'supports' = '!uwp' };
'boost-cobalt' = @{
'supports' = '!uwp';
'features' = @{
'ssl' = @{
'description' = 'Build boost_cobalt_io_ssl';
'dependencies' = @('openssl');
}
}
};
'boost-context' = @{ 'supports' = '!uwp & !emscripten' };
'boost-coroutine' = @{ 'supports' = '!(arm & windows) & !uwp & !emscripten' };
'boost-dll' = @{ 'supports' = '!uwp' };

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "e6ce6495e32ceb722705c37c777fd8f2d9068af4",
"version": "1.91.0",
"port-version": 1
},
{
"git-tree": "9ab3cf2522c0d6074ac5455c552610e1f6e3206b",
"version": "1.91.0",

View File

@ -894,7 +894,7 @@
},
"boost-cobalt": {
"baseline": "1.91.0",
"port-version": 0
"port-version": 1
},
"boost-compat": {
"baseline": "1.91.0",