diff options
author | Daniel Stenberg <daniel@haxx.se> | 2020-03-12 17:18:40 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2020-03-16 22:56:50 +0100 |
commit | 37a05418820dfcdb68bc0d535e76e63945b45917 (patch) | |
tree | 332700ffeb5c378e8768309a71a7d52f3f0064a1 | |
parent | 95c36fff75883ace6e8e7a89b94362de2dd1857f (diff) | |
download | curl-37a05418820dfcdb68bc0d535e76e63945b45917.tar.gz |
cmake: add support for building with wolfSSLbagder/cmake-wolfssl
My working build cmdline:
$ cmake -DCMAKE_PREFIX_PATH=$HOME/build-wolfssl -DCMAKE_USE_WOLFSSL=ON .
Assisted-by: Brad King
Closes #5095
-rw-r--r-- | CMake/FindWolfSSL.cmake | 13 | ||||
-rw-r--r-- | CMakeLists.txt | 17 | ||||
-rw-r--r-- | Makefile.am | 28 | ||||
-rw-r--r-- | lib/curl_config.h.cmake | 3 |
4 files changed, 49 insertions, 12 deletions
diff --git a/CMake/FindWolfSSL.cmake b/CMake/FindWolfSSL.cmake new file mode 100644 index 000000000..8f9a215d0 --- /dev/null +++ b/CMake/FindWolfSSL.cmake @@ -0,0 +1,13 @@ +find_path(WolfSSL_INCLUDE_DIR NAMES wolfssl/ssl.h) +find_library(WolfSSL_LIBRARY NAMES wolfssl) +mark_as_advanced(WolfSSL_INCLUDE_DIR WolfSSL_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(WolfSSL + REQUIRED_VARS WolfSSL_INCLUDE_DIR WolfSSL_LIBRARY + ) + +if(WolfSSL_FOUND) + set(WolfSSL_INCLUDE_DIRS ${WolfSSL_INCLUDE_DIR}) + set(WolfSSL_LIBRARIES ${WolfSSL_LIBRARY}) +endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index 73b053b31..e412b0520 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -298,7 +298,7 @@ if(WIN32) endif() # check SSL libraries -# TODO support GnuTLS and WolfSSL +# TODO support GnuTLS if(APPLE) option(CMAKE_USE_SECTRANSP "enable Apple OS native SSL/TLS" OFF) @@ -311,9 +311,10 @@ endif() option(CMAKE_USE_MBEDTLS "Enable mbedTLS for SSL/TLS" OFF) option(CMAKE_USE_BEARSSL "Enable BearSSL for SSL/TLS" OFF) option(CMAKE_USE_NSS "Enable NSS for SSL/TLS" OFF) +option(CMAKE_USE_WOLFSSL "enable wolfSSL for SSL/TLS" OFF) set(openssl_default ON) -if(WIN32 OR CMAKE_USE_SECTRANSP OR CMAKE_USE_WINSSL OR CMAKE_USE_MBEDTLS OR CMAKE_USE_NSS) +if(WIN32 OR CMAKE_USE_SECTRANSP OR CMAKE_USE_WINSSL OR CMAKE_USE_MBEDTLS OR CMAKE_USE_NSS OR CMAKE_USE_WOLFSSL) set(openssl_default OFF) endif() option(CMAKE_USE_OPENSSL "Use OpenSSL code. Experimental" ${openssl_default}) @@ -325,6 +326,7 @@ count_true(enabled_ssl_options_count CMAKE_USE_MBEDTLS CMAKE_USE_BEARSSL CMAKE_USE_NSS + CMAKE_USE_WOLFSSL ) if(enabled_ssl_options_count GREATER "1") set(CURL_WITH_MULTI_SSL ON) @@ -405,6 +407,14 @@ if(CMAKE_USE_BEARSSL) include_directories(${BEARSSL_INCLUDE_DIRS}) endif() +if(CMAKE_USE_WOLFSSL) + find_package(WolfSSL REQUIRED) + set(SSL_ENABLED ON) + set(USE_WOLFSSL ON) + list(APPEND CURL_LIBS ${WolfSSL_LIBRARIES}) + include_directories(${WolfSSL_INCLUDE_DIRS}) +endif() + if(CMAKE_USE_NSS) find_package(NSS REQUIRED) include_directories(${NSS_INCLUDE_DIRS}) @@ -750,7 +760,7 @@ elseif(CURL_CA_PATH_AUTODETECT OR CURL_CA_BUNDLE_AUTODETECT) endif() if(CURL_CA_PATH_SET AND NOT USE_OPENSSL AND NOT USE_MBEDTLS) - message(FATAL_ERROR + message(STATUS "CA path only supported by OpenSSL, GnuTLS or mbed TLS. " "Set CURL_CA_PATH=none or enable one of those TLS backends.") endif() @@ -1311,6 +1321,7 @@ _add_if("Secure Transport" SSL_ENABLED AND USE_SECTRANSP) _add_if("mbedTLS" SSL_ENABLED AND USE_MBEDTLS) _add_if("BearSSL" SSL_ENABLED AND USE_BEARSSL) _add_if("NSS" SSL_ENABLED AND USE_NSS) +_add_if("wolfSSL" SSL_ENABLED AND USE_WOLFSSL) if(_items) list(SORT _items) endif() diff --git a/Makefile.am b/Makefile.am index cb679a380..5eacfa846 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,7 +5,7 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al. +# Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -24,14 +24,24 @@ AUTOMAKE_OPTIONS = foreign ACLOCAL_AMFLAGS = -I m4 -CMAKE_DIST = CMakeLists.txt CMake/CMakeConfigurableFile.in \ - CMake/CurlTests.c CMake/FindGSS.cmake CMake/OtherTests.cmake \ - CMake/Platforms/WindowsCache.cmake CMake/Utilities.cmake \ - CMake/Macros.cmake \ - CMake/CurlSymbolHiding.cmake CMake/FindCARES.cmake \ - CMake/FindLibSSH2.cmake CMake/FindNGHTTP2.cmake \ - CMake/FindMbedTLS.cmake CMake/FindBearSSL.cmake \ - CMake/cmake_uninstall.cmake.in CMake/curl-config.cmake.in +CMAKE_DIST = \ + CMake/cmake_uninstall.cmake.in \ + CMake/CMakeConfigurableFile.in \ + CMake/curl-config.cmake.in \ + CMake/CurlSymbolHiding.cmake \ + CMake/CurlTests.c \ + CMake/FindBearSSL.cmake \ + CMake/FindCARES.cmake \ + CMake/FindGSS.cmake \ + CMake/FindLibSSH2.cmake \ + CMake/FindMbedTLS.cmake \ + CMake/FindNGHTTP2.cmake \ + CMake/FindWolfSSL.cmake \ + CMake/Macros.cmake \ + CMake/OtherTests.cmake \ + CMake/Platforms/WindowsCache.cmake \ + CMake/Utilities.cmake \ + CMakeLists.txt VC6_LIBTMPL = projects/Windows/VC6/lib/libcurl.tmpl VC6_LIBDSP = projects/Windows/VC6/lib/libcurl.dsp.dist diff --git a/lib/curl_config.h.cmake b/lib/curl_config.h.cmake index 98cdf5145..8320f8710 100644 --- a/lib/curl_config.h.cmake +++ b/lib/curl_config.h.cmake @@ -945,6 +945,9 @@ ${SIZEOF_TIME_T_CODE} /* if BearSSL is enabled */ #cmakedefine USE_BEARSSL 1 +/* if WolfSSL is enabled */ +#cmakedefine USE_WOLFSSL 1 + /* if libSSH2 is in use */ #cmakedefine USE_LIBSSH2 1 |