diff options
author | Brad King <brad.king@kitware.com> | 2016-02-26 19:19:51 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-02-29 16:51:04 (GMT) |
commit | 190a5fdffd8104ad613854bdd563a0a11dd88f63 (patch) | |
tree | 64020c3fd966169b51cca6404a5c8c68cec8a8cf /CMakeLists.txt | |
parent | 6b0a664c1639b19ccc652a4be5f9824d0bf88e48 (diff) | |
download | CMake-190a5fdffd8104ad613854bdd563a0a11dd88f63.zip CMake-190a5fdffd8104ad613854bdd563a0a11dd88f63.tar.gz CMake-190a5fdffd8104ad613854bdd563a0a11dd88f63.tar.bz2 |
Automatically use OpenSSL by default on Linux and FreeBSD if available
Since https is almost ubiquitous nowadays we should support it by
default whenever possible. When building our own curl, we already
automatically enable SSL/TLS support on Windows and OS X by using the
OS-native APIs. On UNIX platforms we need to use OpenSSL but have not
done so by default before, leading to possible user confusion when https
transfers fail later. Fix this by searching for OpenSSL quietly and
enabling use of it automatically if it is found.
Do this only on Linux and FreeBSD for now because on other UNIX
platforms (e.g. AIX, HP-UX, SunOS) it seems too easy to find an
OpenSSL that is not compatible with the target compiler.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 9381f35..787f319 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -327,7 +327,15 @@ macro (CMAKE_BUILD_UTILITIES) if(CMAKE_TESTS_CDASH_SERVER) set(CMAKE_CURL_TEST_URL "${CMAKE_TESTS_CDASH_SERVER}/user.php") endif() - option(CMAKE_USE_OPENSSL "Use OpenSSL." OFF) + set(_CMAKE_USE_OPENSSL_DEFAULT OFF) + if(NOT DEFINED CMAKE_USE_OPENSSL AND NOT WIN32 AND NOT APPLE + AND CMAKE_SYSTEM_NAME MATCHES "(Linux|FreeBSD)") + find_package(OpenSSL QUIET) + if(OPENSSL_FOUND) + set(_CMAKE_USE_OPENSSL_DEFAULT ON) + endif() + endif() + option(CMAKE_USE_OPENSSL "Use OpenSSL." ${_CMAKE_USE_OPENSSL_DEFAULT}) mark_as_advanced(CMAKE_USE_OPENSSL) if(CMAKE_USE_OPENSSL) set(CURL_CA_BUNDLE "" CACHE FILEPATH "Path to SSL CA Certificate Bundle") |