cpr_option(CPR_GENERATE_COVERAGE"Set to ON to generate coverage reports."OFF)
cpr_option(CPR_CURL_NOSIGNAL"Set to ON to disable use of signals in libcurl."OFF)
cpr_option(CURL_VERBOSE_LOGGING"Curl verbose logging during building curl"OFF)
cpr_option(CPR_USE_SYSTEM_GTEST"If ON, this project will look in the system paths for an installed gtest library. If none is found it will use the build in one."OFF)
cpr_option(CPR_USE_SYSTEM_CURL"If enabled we will use the curl lib already installed on this system."OFF)
cpr_option(CPR_ENABLE_SSL"Enables or disables the SSL backend. Required to perform HTTPS requests."ON)
cpr_option(CPR_FORCE_OPENSSL_BACKEND"Force to use the OpenSSL backend. If CPR_FORCE_OPENSSL_BACKEND, CPR_FORCE_DARWINSSL_BACKEND, CPR_FORCE_MBEDTLS_BACKEND, and CPR_FORCE_WINSSL_BACKEND are set to to OFF, cpr will try to automatically detect the best available SSL backend (WinSSL - Windows, OpenSSL - Linux, DarwinSSL - Mac ...)."OFF)
cpr_option(CPR_FORCE_WINSSL_BACKEND"Force to use the WinSSL backend. If CPR_FORCE_OPENSSL_BACKEND, CPR_FORCE_DARWINSSL_BACKEND, CPR_FORCE_MBEDTLS_BACKEND, and CPR_FORCE_WINSSL_BACKEND are set to to OFF, cpr will try to automatically detect the best available SSL backend (WinSSL - Windows, OpenSSL - Linux, DarwinSSL - Mac ...)."OFF)
cpr_option(CPR_FORCE_DARWINSSL_BACKEND"Force to use the DarwinSSL backend. If CPR_FORCE_OPENSSL_BACKEND, CPR_FORCE_DARWINSSL_BACKEND, CPR_FORCE_MBEDTLS_BACKEND, and CPR_FORCE_WINSSL_BACKEND are set to to OFF, cpr will try to automatically detect the best available SSL backend (WinSSL - Windows, OpenSSL - Linux, DarwinSSL - Mac ...)."OFF)
cpr_option(CPR_FORCE_MBEDTLS_BACKEND"Force to use the Mbed TLS backend. If CPR_FORCE_OPENSSL_BACKEND, CPR_FORCE_DARWINSSL_BACKEND, CPR_FORCE_MBEDTLS_BACKEND, and CPR_FORCE_WINSSL_BACKEND are set to to OFF, cpr will try to automatically detect the best available SSL backend (WinSSL - Windows, OpenSSL - Linux, DarwinSSL - Mac ...)."OFF)
cpr_option(CPR_ENABLE_LINTING"Set to ON to enable clang linting."OFF)
cpr_option(CPR_ENABLE_CPPCHECK"Set to ON to enable Cppcheck static analysis. Requires CPR_BUILD_TESTS and CPR_BUILD_TESTS_SSL to be OFF to prevent checking google tests source code."OFF)
cpr_option(CPR_BUILD_TESTS"Set to ON to build cpr tests."OFF)
cpr_option(CPR_BUILD_TESTS_SSL"Set to ON to build cpr ssl tests"${CPR_BUILD_TESTS})
cpr_option(CPR_BUILD_TESTS_PROXY"Set to ON to build proxy tests. They fail in case there is no valid proxy server available in proxy_tests.cpp"OFF)
cpr_option(CPR_SKIP_CA_BUNDLE_SEARCH"Skip searching for Certificate Authority certs. Turn ON systems like iOS where file access is restricted and prevents https from working."OFF)
cpr_option(CPR_USE_BOOST_FILESYSTEM"Set to ON to use the Boost.Filesystem library on OSX."OFF)
message(FATAL_ERROR"Cppcheck is incompatible with building tests. Make sure to disable CPR_ENABLE_CPPCHECK or disable tests by setting CPR_BUILD_TESTS and CPR_BUILD_TESTS_SSL to OFF. This is because Cppcheck would try to check the google tests source code and then fail. ")
message(STATUS"Disabled SSL backend auto detect since either CPR_FORCE_OPENSSL_BACKEND, CPR_FORCE_DARWINSSL_BACKEND, CPR_FORCE_MBEDTLS_BACKEND, or CPR_FORCE_WINSSL_BACKEND is enabled.")
message(FATAL_ERROR"WinSSL is only available on Windows! Use either OpenSSL (CPR_FORCE_OPENSSL_BACKEND) or DarwinSSL (CPR_FORCE_DARWINSSL_BACKEND) instead.")
endif()
if(DETECT_SSL_BACKEND)
message(STATUS"Detecting SSL backend...")
if(WIN32)
message(STATUS"SSL auto detect: Using WinSSL.")
set(SSL_BACKEND_USED"WinSSL")
elseif(APPLE)
message(STATUS"SSL auto detect: Using DarwinSSL.")
set(CPR_BUILD_TESTS_SSLOFF)
set(SSL_BACKEND_USED"DarwinSSL")
else()
find_package(OpenSSL)
if(OPENSSL_FOUND)
message(STATUS"SSL auto detect: Using OpenSSL.")
set(SSL_BACKEND_USED"OpenSSL")
else()
find_package(MbedTLS)
if(MBEDTLS_FOUND)
set(SSL_BACKEND_USED"MbedTLS")
else()
message(FATAL_ERROR"No valid SSL backend found! Please install OpenSSL, Mbed TLS or disable SSL by setting CPR_ENABLE_SSL to OFF.")
endif()
endif()
endif()
else()
if(CPR_FORCE_OPENSSL_BACKEND)
find_package(OpenSSL)
if(OPENSSL_FOUND)
message(STATUS"Using OpenSSL.")
set(SSL_BACKEND_USED"OpenSSL")
else()
message(FATAL_ERROR"CPR_FORCE_OPENSSL_BACKEND enabled but we were not able to find OpenSSL!")
endif()
elseif(CPR_FORCE_WINSSL_BACKEND)
message(STATUS"Using WinSSL.")
set(SSL_BACKEND_USED"WinSSL")
elseif(CPR_FORCE_DARWINSSL_BACKEND)
message(STATUS"Using DarwinSSL.")
set(CPR_BUILD_TESTS_SSLOFF)
set(SSL_BACKEND_USED"DarwinSSL")
elseif(CPR_FORCE_MBEDTLS_BACKEND)
message(STATUS"Using Mbed TLS.")
set(CPR_BUILD_TESTS_SSLOFF)
set(SSL_BACKEND_USED"MbedTLS")
endif()
endif()
endif()
if(SSL_BACKEND_USEDSTREQUAL"OpenSSL")
# Fix missing OpenSSL includes for Windows since in 'ssl_ctx.cpp' we include OpenSSL directly
message(FATAL_ERROR"Your system curl version (${CURL_VERSION_STRING}) is too old to support OpenSSL on Windows which requires curl >= 7.71.0. Update your curl version, use WinSSL, disable SSL or use the build in version of curl.")
endif()
else()
find_package(CURLCOMPONENTSHTTP)
if(CURL_FOUND)
message(FATAL_ERROR"Curl found on this system but WITHOUT HTTPS/SSL support. Either disable SSL by setting CPR_ENABLE_SSL to OFF or use the build in version of curl by setting CPR_USE_SYSTEM_CURL to OFF.")
else()
message(FATAL_ERROR"Curl not found on this system. To use the build in version set CPR_USE_SYSTEM_CURL to OFF.")
endif()
endif()
else()
find_package(CURLCOMPONENTSHTTP)
if(CURL_FOUND)
message(STATUS"Curl found on this system.")
else()
message(FATAL_ERROR"Curl not found on this system. To use the build in version set CPR_USE_SYSTEM_CURL to OFF.")
message(STATUS"Building mongoose project for test support.")
if(CPR_BUILD_TESTS_SSL)
if(NOTCPR_ENABLE_SSL)
message(FATAL_ERROR"OpenSSL is required to build SSL test but CPR_ENABLE_SSL is disabled. Either set CPR_ENABLE_SSL to ON or disable CPR_BUILD_TESTS_SSL.")
endif()
if(NOT(SSL_BACKEND_USEDSTREQUAL"OpenSSL"))
message(FATAL_ERROR"OpenSSL is required for SSL test, but it seams like OpenSSL is not being used as SSL backend. Either set CPR_BUILD_TESTS_SSL to OFF or set CPR_FORCE_OPENSSL_BACKEND to ON and try again.")