summaryrefslogtreecommitdiff
path: root/CMake/Modules/FindLibcurl.cmake
blob: fe389c49c406fa832d8614386133c9702fc14c0e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# - Try to find libcurl
# Once done this will define
#
#  LIBCURL_FOUND - system has libcurl
#  LIBCURL_INCLUDE_DIR - the libcurl include directory
#  LIBCURL_LIBRARIES - the libraries needed to use libcurl
#  LIBCURL_DEFINITIONS - Compiler switches required for using libcurl

IF (Libcurl_INCLUDE_DIR AND Libcurl_LIBRARY)
   SET(Libcurl_FIND_QUIETLY TRUE)
ENDIF (Libcurl_INCLUDE_DIR AND Libcurl_LIBRARY)

FIND_PATH(Libcurl_INCLUDE_DIR curl/curl.h
    /usr/include
    /usr/local/include
    )

FIND_LIBRARY(Libcurl_LIBRARY
    NAMES curl
    PATHS /usr/lib /usr/local/lib
    )

IF (Libcurl_INCLUDE_DIR AND Libcurl_LIBRARY)
    SET(LIBCURL_FOUND TRUE)
    SET(LIBCURL_INCLUDE_DIR ${Libcurl_INCLUDE_DIR})
    SET(LIBCURL_LIBRARIES ${Libcurl_LIBRARY})
ELSE (Libcurl_INCLUDE_DIR AND Libcurl_LIBRARY)
    SET(LIBCURL_FOUND TRUE)
ENDIF (Libcurl_INCLUDE_DIR AND Libcurl_LIBRARY)

IF (LIBCURL_FOUND)
    IF (NOT Libcurl_FIND_QUIETLY)
        MESSAGE(STATUS "Found libcurl: ${Libcurl_LIBRARY}")
    ENDIF (NOT Libcurl_FIND_QUIETLY)
ELSE (LIBCURL_FOUND)
    IF (Libcurl_FIND_REQUIRED)
        MESSAGE(SEND_ERROR "Could NOT find libcurl")
    ENDIF (Libcurl_FIND_REQUIRED)
ENDIF (LIBCURL_FOUND)

MARK_AS_ADVANCED(Libcurl_INCLUDE_DIR Libcurl_LIBRARY)