aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorjenkins4kodi <jenkins4kodi@users.noreply.github.com>2019-02-21 16:58:17 +0100
committerGitHub <noreply@github.com>2019-02-21 16:58:17 +0100
commite517ffc1341498b0c91965d5dda01e9988f6bd19 (patch)
tree319bac6724b56634285161a92530934aa5e71d81 /cmake
parentd01232ec306ceb3083f339a731505ca6f538a1c4 (diff)
parent8839957437f2c1557c5810aff2af820e50826370 (diff)
Merge pull request #15195 from wsnipex/nghttp2
Diffstat (limited to '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 6ccf44ac23..6411a92915 100644
--- a/cmake/modules/FindCurl.cmake
+++ b/cmake/modules/FindCurl.cmake
@@ -25,6 +25,19 @@ find_library(CURL_LIBRARY NAMES curl libcurl libcurl_imp
set(CURL_VERSION ${PC_CURL_VERSION})
+set(CURL_LIB_TYPE SHARED)
+set(CURL_LDFLAGS ${PC_CURL_LDFLAGS})
+
+# check if curl is statically linked
+if(${CURL_LIBRARY} MATCHES ".+\.a$" AND PC_CURL_STATIC_LDFLAGS)
+ set(CURL_LIB_TYPE STATIC)
+ set(CURL_LDFLAGS ${PC_CURL_STATIC_LDFLAGS})
+
+ pkg_check_modules(PC_NGHTTP2 libnghttp2 QUIET)
+ find_library(NGHTTP2_LIBRARY NAMES libnghttp2 nghttp2
+ PATHS ${PC_NGHTTP2_LIBDIR})
+endif()
+
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Curl
REQUIRED_VARS CURL_LIBRARY CURL_INCLUDE_DIR
@@ -32,10 +45,10 @@ find_package_handle_standard_args(Curl
if(CURL_FOUND)
set(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR})
- set(CURL_LIBRARIES ${CURL_LIBRARY})
+ set(CURL_LIBRARIES ${CURL_LIBRARY} ${NGHTTP2_LIBRARY})
if(NOT TARGET Curl::Curl)
- add_library(Curl::Curl UNKNOWN IMPORTED)
+ add_library(Curl::Curl ${CURL_LIB_TYPE} IMPORTED)
set_target_properties(Curl::Curl PROPERTIES
IMPORTED_LOCATION "${CURL_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIR}")
@@ -46,4 +59,4 @@ if(CURL_FOUND)
endif()
endif()
-mark_as_advanced(CURL_INCLUDE_DIR CURL_LIBRARY)
+mark_as_advanced(CURL_INCLUDE_DIR CURL_LIBRARY CURL_LDFLAGS)