diff options
| author | Kenjiro Nakayama <nakayamakenjiro@gmail.com> | 2026-06-15 07:58:06 +0900 |
|---|---|---|
| committer | Kenjiro Nakayama <nakayamakenjiro@gmail.com> | 2026-06-15 10:36:32 +0900 |
| commit | c85e07d0d68129fc1b1c9039b266099c8d735c3d (patch) | |
| tree | b492957ab6a8f828d083cda10fdde58918eea012 | |
| parent | 00b7d56c290e4cdceeddbb98497c9ff23c49dc32 (diff) | |
| download | portable-c85e07d0d68129fc1b1c9039b266099c8d735c3d.tar.gz portable-c85e07d0d68129fc1b1c9039b266099c8d735c3d.tar.bz2 portable-c85e07d0d68129fc1b1c9039b266099c8d735c3d.zip | |
Allow overriding TLS_DEFAULT_CA_FILE in CMake builds
The CMake build unconditionally defined `TLS_DEFAULT_CA_FILE` as
`${OPENSSLDIR}/cert.pem`, so a value supplied with
`-DTLS_DEFAULT_CA_FILE` was ignored.
Add `TLS_DEFAULT_CA_FILE` as a cache variable and use it for the libtls
definition, falling back to `${OPENSSLDIR}/cert.pem` when unset.
| -rw-r--r-- | CMakeLists.txt | 5 | ||||
| -rw-r--r-- | tls/CMakeLists.txt | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ab04ab..d3424c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
| @@ -55,6 +55,7 @@ option(ENABLE_ASM "Enable assembly" ON) | |||
| 55 | option(ENABLE_EXTRATESTS "Enable extra tests that may be unreliable on some platforms" OFF) | 55 | option(ENABLE_EXTRATESTS "Enable extra tests that may be unreliable on some platforms" OFF) |
| 56 | option(ENABLE_NC "Enable installing TLS-enabled nc(1)" OFF) | 56 | option(ENABLE_NC "Enable installing TLS-enabled nc(1)" OFF) |
| 57 | set(OPENSSLDIR ${OPENSSLDIR} CACHE PATH "Set the default openssl directory" FORCE) | 57 | set(OPENSSLDIR ${OPENSSLDIR} CACHE PATH "Set the default openssl directory" FORCE) |
| 58 | set(TLS_DEFAULT_CA_FILE ${TLS_DEFAULT_CA_FILE} CACHE PATH "Set the default CA file" FORCE) | ||
| 58 | set(LIBRESSL_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/LibreSSL" CACHE STRING "Installation directory for the CMake targets") | 59 | set(LIBRESSL_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/LibreSSL" CACHE STRING "Installation directory for the CMake targets") |
| 59 | 60 | ||
| 60 | option(USE_STATIC_MSVC_RUNTIMES "Use /MT instead of /MD in MSVC" OFF) | 61 | option(USE_STATIC_MSVC_RUNTIMES "Use /MT instead of /MD in MSVC" OFF) |
| @@ -506,6 +507,10 @@ else() | |||
| 506 | set(CONF_DIR "${OPENSSLDIR}") | 507 | set(CONF_DIR "${OPENSSLDIR}") |
| 507 | endif() | 508 | endif() |
| 508 | 509 | ||
| 510 | if(TLS_DEFAULT_CA_FILE STREQUAL "") | ||
| 511 | set(TLS_DEFAULT_CA_FILE "${OPENSSLDIR}/cert.pem") | ||
| 512 | endif() | ||
| 513 | |||
| 509 | add_subdirectory(include) | 514 | add_subdirectory(include) |
| 510 | add_subdirectory(crypto) | 515 | add_subdirectory(crypto) |
| 511 | add_subdirectory(ssl) | 516 | add_subdirectory(ssl) |
diff --git a/tls/CMakeLists.txt b/tls/CMakeLists.txt index a1b244a..258cd95 100644 --- a/tls/CMakeLists.txt +++ b/tls/CMakeLists.txt | |||
| @@ -41,7 +41,7 @@ if(WIN32) | |||
| 41 | set(TLS_COMPAT_SRC ${TLS_COMPAT_SRC} compat/pwrite.c) | 41 | set(TLS_COMPAT_SRC ${TLS_COMPAT_SRC} compat/pwrite.c) |
| 42 | endif() | 42 | endif() |
| 43 | 43 | ||
| 44 | add_definitions(-DTLS_DEFAULT_CA_FILE=\"${OPENSSLDIR}/cert.pem\") | 44 | add_definitions(-DTLS_DEFAULT_CA_FILE=\"${TLS_DEFAULT_CA_FILE}\") |
| 45 | 45 | ||
| 46 | file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/tls.sym DESTINATION | 46 | file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/tls.sym DESTINATION |
| 47 | ${CMAKE_CURRENT_BINARY_DIR}) | 47 | ${CMAKE_CURRENT_BINARY_DIR}) |
