summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindCurl.cmake
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2019-04-29 12:23:35 +0200
committermanuel <manuel@mausz.at>2019-04-29 12:23:35 +0200
commitcf85cccfdb1aa57b6246641f606563288e0870e5 (patch)
tree06b9d173bf466d555d99803d1bce388e666444e5 /cmake/modules/FindCurl.cmake
parent483c0b88bfc1b798396c31a4dd2f5239399ce59e (diff)
downloadkodi-pvr-build-cf85cccfdb1aa57b6246641f606563288e0870e5.tar.gz
kodi-pvr-build-cf85cccfdb1aa57b6246641f606563288e0870e5.tar.bz2
kodi-pvr-build-cf85cccfdb1aa57b6246641f606563288e0870e5.zip
sync with upstreamLeia
Diffstat (limited to 'cmake/modules/FindCurl.cmake')
-rw-r--r--cmake/modules/FindCurl.cmake19
1 files changed, 16 insertions, 3 deletions
diff --git a/cmake/modules/FindCurl.cmake b/cmake/modules/FindCurl.cmake
index 6ccf44a..6411a92 100644
--- a/cmake/modules/FindCurl.cmake
+++ b/cmake/modules/FindCurl.cmake
@@ -25,6 +25,19 @@ find_library(CURL_LIBRARY NAMES curl libcurl libcurl_imp
25 25
26set(CURL_VERSION ${PC_CURL_VERSION}) 26set(CURL_VERSION ${PC_CURL_VERSION})
27 27
28set(CURL_LIB_TYPE SHARED)
29set(CURL_LDFLAGS ${PC_CURL_LDFLAGS})
30
31# check if curl is statically linked
32if(${CURL_LIBRARY} MATCHES ".+\.a$" AND PC_CURL_STATIC_LDFLAGS)
33 set(CURL_LIB_TYPE STATIC)
34 set(CURL_LDFLAGS ${PC_CURL_STATIC_LDFLAGS})
35
36 pkg_check_modules(PC_NGHTTP2 libnghttp2 QUIET)
37 find_library(NGHTTP2_LIBRARY NAMES libnghttp2 nghttp2
38 PATHS ${PC_NGHTTP2_LIBDIR})
39endif()
40
28include(FindPackageHandleStandardArgs) 41include(FindPackageHandleStandardArgs)
29find_package_handle_standard_args(Curl 42find_package_handle_standard_args(Curl
30 REQUIRED_VARS CURL_LIBRARY CURL_INCLUDE_DIR 43 REQUIRED_VARS CURL_LIBRARY CURL_INCLUDE_DIR
@@ -32,10 +45,10 @@ find_package_handle_standard_args(Curl
32 45
33if(CURL_FOUND) 46if(CURL_FOUND)
34 set(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR}) 47 set(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR})
35 set(CURL_LIBRARIES ${CURL_LIBRARY}) 48 set(CURL_LIBRARIES ${CURL_LIBRARY} ${NGHTTP2_LIBRARY})
36 49
37 if(NOT TARGET Curl::Curl) 50 if(NOT TARGET Curl::Curl)
38 add_library(Curl::Curl UNKNOWN IMPORTED) 51 add_library(Curl::Curl ${CURL_LIB_TYPE} IMPORTED)
39 set_target_properties(Curl::Curl PROPERTIES 52 set_target_properties(Curl::Curl PROPERTIES
40 IMPORTED_LOCATION "${CURL_LIBRARY}" 53 IMPORTED_LOCATION "${CURL_LIBRARY}"
41 INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIR}") 54 INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIR}")
@@ -46,4 +59,4 @@ if(CURL_FOUND)
46 endif() 59 endif()
47endif() 60endif()
48 61
49mark_as_advanced(CURL_INCLUDE_DIR CURL_LIBRARY) 62mark_as_advanced(CURL_INCLUDE_DIR CURL_LIBRARY CURL_LDFLAGS)