2006-10-19 20:55:44 +04:00
|
|
|
# - Find curl
|
|
|
|
# Find the native CURL headers and libraries.
|
|
|
|
#
|
2012-01-24 00:46:56 +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
|
|
|
|
2009-09-28 19:45:50 +04:00
|
|
|
#=============================================================================
|
|
|
|
# Copyright 2006-2009 Kitware, Inc.
|
2012-01-24 00:46:56 +04:00
|
|
|
# Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
|
2009-09-28 19:45:50 +04:00
|
|
|
#
|
|
|
|
# Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
# see accompanying file Copyright.txt for details.
|
|
|
|
#
|
|
|
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
# See the License for more information.
|
|
|
|
#=============================================================================
|
2010-08-07 04:48:47 +04:00
|
|
|
# (To distribute this file outside of CMake, substitute the full
|
2009-09-28 19:45:50 +04:00
|
|
|
# License text for the above reference.)
|
|
|
|
|
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
|
|
|
|
|
|
|
# Look for the library.
|
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-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()
|
|
|
|
endforeach(_curl_version_header)
|
|
|
|
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})
|
|
|
|
endif(CURL_FOUND)
|