[patches] [PATCH] [http client] Check if libcurl supports SSL

Konstantin Belyavskiy k.belyavskiy at tarantool.org
Thu Mar 1 18:33:44 MSK 2018


On MAC several old curl versions don't support SSL by default.
Try to check it and print error message if so.

Close #3065
---
branch: gh-3065-check-curl-ssl-support

 cmake/FindCURL.cmake | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/cmake/FindCURL.cmake b/cmake/FindCURL.cmake
index 098544ab2..c71652568 100644
--- a/cmake/FindCURL.cmake
+++ b/cmake/FindCURL.cmake
@@ -68,4 +68,24 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(CURL
 if(CURL_FOUND)
   set(CURL_LIBRARIES ${CURL_LIBRARY})
   set(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR})
+  set(CMAKE_REQUIRED_LIBRARIES ${CURL_LIBRARIES})
+  set(CMAKE_REQUIRED_INCLUDES ${CURL_INCLUDE_DIRS})
+  check_c_source_runs("
+    #include <curl/curl.h>
+
+    int main()
+    {
+    #ifdef CURL_VERSION_SSL
+        curl_version_info_data *data = curl_version_info(CURLVERSION_NOW);
+        if (data->features & CURL_VERSION_SSL)
+            return 0;
+    #endif
+        return -1;
+    }
+    " CURL_SUPPORTS_SSL)
+  set(CMAKE_REQUIRED_LIBRARIES "")
+  set(CMAKE_REQUIRED_INCLUDES "")
+  if (NOT DEFINED CURL_SUPPORTS_SSL_EXITCODE OR CURL_SUPPORTS_SSL_EXITCODE)
+    message(FATAL_ERROR "Curl was build without SSL support")
+  endif()
 endif()
-- 
2.14.3 (Apple Git-98)




More information about the Tarantool-patches mailing list