2016-09-27 22:01:08 +03:00
|
|
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
|
|
|
|
2013-10-15 19:17:36 +04:00
|
|
|
#.rst:
|
|
|
|
# FindCURL
|
|
|
|
# --------
|
|
|
|
#
|
|
|
|
# Find curl
|
|
|
|
#
|
2006-10-19 20:55:44 +04:00
|
|
|
# Find the native CURL headers and libraries.
|
|
|
|
#
|
2013-10-15 19:17:36 +04:00
|
|
|
# ::
|
|
|
|
#
|
|
|
|
# CURL_INCLUDE_DIRS - where to find curl/curl.h, etc.
|
|
|
|
# CURL_LIBRARIES - List of libraries when using curl.
|
|
|
|
# CURL_FOUND - True if curl found.
|
|
|
|
# CURL_VERSION_STRING - the version of curl found (since CMake 2.8.8)
|
2006-10-19 20:55:44 +04:00
|
|
|
|
|
|
|
# Look for the header file.
|
2012-08-13 21:47:32 +04:00
|
|
|
find_path(CURL_INCLUDE_DIR NAMES curl/curl.h)
|
|
|
|
mark_as_advanced(CURL_INCLUDE_DIR)
|
2006-10-19 20:55:44 +04:00
|
|
|
|
2012-09-30 12:19:00 +04:00
|
|
|
# Look for the library (sorted from most current/relevant entry to least).
|
2012-08-13 21:47:32 +04:00
|
|
|
find_library(CURL_LIBRARY NAMES
|
2010-01-05 07:25:57 +03:00
|
|
|
curl
|
|
|
|
# Windows MSVC prebuilts:
|
|
|
|
curllib
|
|
|
|
libcurl_imp
|
|
|
|
curllib_static
|
2012-09-30 12:19:00 +04:00
|
|
|
# Windows older "Win32 - MSVC" prebuilts (libcurl.lib, e.g. libcurl-7.15.5-win32-msvc.zip):
|
|
|
|
libcurl
|
2010-01-05 07:25:57 +03:00
|
|
|
)
|
2012-08-13 21:47:32 +04:00
|
|
|
mark_as_advanced(CURL_LIBRARY)
|
2006-10-19 20:55:44 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if(CURL_INCLUDE_DIR)
|
|
|
|
foreach(_curl_version_header curlver.h curl.h)
|
|
|
|
if(EXISTS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}")
|
|
|
|
file(STRINGS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}" curl_version_str REGEX "^#define[\t ]+LIBCURL_VERSION[\t ]+\".*\"")
|
2012-01-24 00:46:56 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
string(REGEX REPLACE "^#define[\t ]+LIBCURL_VERSION[\t ]+\"([^\"]*)\".*" "\\1" CURL_VERSION_STRING "${curl_version_str}")
|
|
|
|
unset(curl_version_str)
|
|
|
|
break()
|
|
|
|
endif()
|
2012-08-13 21:50:14 +04:00
|
|
|
endforeach()
|
2012-08-13 21:47:32 +04:00
|
|
|
endif()
|
2012-01-24 00:46:56 +04:00
|
|
|
|
2012-08-13 21:42:58 +04:00
|
|
|
# handle the QUIETLY and REQUIRED arguments and set CURL_FOUND to TRUE if
|
2007-07-19 17:00:51 +04:00
|
|
|
# all listed variables are TRUE
|
2012-08-13 21:47:32 +04:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
2012-01-24 00:46:56 +04:00
|
|
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CURL
|
|
|
|
REQUIRED_VARS CURL_LIBRARY CURL_INCLUDE_DIR
|
|
|
|
VERSION_VAR CURL_VERSION_STRING)
|
2007-07-19 17:00:51 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if(CURL_FOUND)
|
|
|
|
set(CURL_LIBRARIES ${CURL_LIBRARY})
|
|
|
|
set(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR})
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|