Support ENABLE_TLS_NATIVE_ROOTS to use system TLS CAs (#3660)

This commit is contained in:
Dustin J. Mitchell
2024-11-02 06:16:23 -04:00
committed by GitHub
parent 94c95563ab
commit 8184226319
3 changed files with 75 additions and 2 deletions

View File

@@ -7,12 +7,20 @@ else()
add_subdirectory(${CMAKE_SOURCE_DIR}/src/taskchampion-cpp/corrosion)
endif()
OPTION (ENABLE_TLS_NATIVE_ROOTS "Use the system's TLS root certificates" OFF)
if (ENABLE_TLS_NATIVE_ROOTS)
message ("Enabling native TLS roots")
set(TASKCHAMPION_FEATURES "tls-native-roots")
endif (ENABLE_TLS_NATIVE_ROOTS)
# Import taskchampion-lib as a CMake library. This implements the Rust side of
# the cxxbridge, and depends on the `taskchampion` crate.
corrosion_import_crate(
MANIFEST_PATH "${CMAKE_SOURCE_DIR}/Cargo.toml"
LOCKED
CRATES "taskchampion-lib")
CRATES "taskchampion-lib"
FEATURES "${TASKCHAMPION_FEATURES}")
# Set up `taskchampion-cpp`, the C++ side of the bridge.
corrosion_add_cxxbridge(taskchampion-cpp

View File

@@ -11,5 +11,9 @@ crate-type = ["staticlib"]
taskchampion = "0.9.0"
cxx = "1.0.124"
[features]
# use native CA roots, instead of bundled
tls-native-roots = ["taskchampion/tls-native-roots"]
[build-dependencies]
cxx-build = "1.0"