summaryrefslogtreecommitdiffstats
path: root/project/cmake/modules/FindCurl.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'project/cmake/modules/FindCurl.cmake')
-rw-r--r--project/cmake/modules/FindCurl.cmake37
1 files changed, 37 insertions, 0 deletions
diff --git a/project/cmake/modules/FindCurl.cmake b/project/cmake/modules/FindCurl.cmake
new file mode 100644
index 0000000..a2e8862
--- /dev/null
+++ b/project/cmake/modules/FindCurl.cmake
@@ -0,0 +1,37 @@
1# - Try to find CURL
2# Once done this will define
3#
4# CURL_FOUND - system has libcurl
5# CURL_INCLUDE_DIRS - the libcurl include directory
6# CURL_LIBRARIES - The libcurl libraries
7
8if(PKG_CONFIG_FOUND)
9 pkg_check_modules (CURL libcurl)
10 list(APPEND CURL_INCLUDE_DIRS ${CURL_INCLUDEDIR})
11else()
12 find_path(CURL_INCLUDE_DIRS curl/curl.h)
13 find_library(CURL_LIBRARIES NAMES curl libcurl)
14endif()
15include(FindPackageHandleStandardArgs)
16find_package_handle_standard_args(Curl DEFAULT_MSG CURL_INCLUDE_DIRS CURL_LIBRARIES)
17
18mark_as_advanced(CURL_INCLUDE_DIRS CURL_LIBRARIES)
19
20if(CURL_FOUND)
21 if(NOT CURL_LIBRARY_DIRS AND CURL_LIBDIR)
22 set(CURL_LIBRARY_DIRS ${CURL_LIBDIR})
23 endif()
24
25 find_soname(CURL)
26
27 if(EXISTS "${CURL_LIBRARY_DIRS}/${CURL_SONAME}")
28 execute_process(COMMAND readelf -s ${CURL_LIBRARY_DIRS}/${CURL_SONAME} COMMAND grep CRYPTO_set_locking_call OUTPUT_VARIABLE HAS_CURL_STATIC)
29 else()
30 message(FATAL_ERROR "curl library not found")
31 endif()
32endif()
33
34if(HAS_CURL_STATIC)
35 mark_as_advanced(HAS_CURL_STATIC)
36 list(APPEND CURL_DEFINITIONS -DHAS_CURL_STATIC=1)
37endif()